Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upFailure to locate link.exe in preconfigured environment #42607
Comments
retep998
added
O-windows-msvc
regression-from-stable-to-beta
labels
Jun 12, 2017
retep998
added this to the 1.19 milestone
Jun 12, 2017
retep998
assigned
brson
Jun 12, 2017
brson
added
P-high
A-linkage
I-wrong
labels
Jun 15, 2017
This comment has been minimized.
This comment has been minimized.
|
OK, so we sat down and debugged this today. Mozilla's build environment for invoking https://dxr.mozilla.org/mozilla-central/source/config/rules.mk#886 We do not, however, remove Current master (and, I assume beta) uses https://github.com/alexcrichton/gcc-rs/blob/master/src/windows_registry.rs#L68 So if https://github.com/rust-lang/rust/blob/stable/src/librustc_trans/back/msvc/mod.rs#L58 Specifically, we will look for https://github.com/rust-lang/rust/blob/stable/src/librustc_trans/back/msvc/mod.rs#L93 We have the same logic for looking for known Visual Studio installation directories in master and beta: https://github.com/alexcrichton/gcc-rs/blob/master/src/windows_registry.rs#L76 But in So we have a behavior change here between stable Rust and beta/master Rust. Whether this was intended, I can't say, nor whether the current master behavior is a good idea. It's possible that Firefox should also be removing @alexcrichton it looks like you wrote the bits in |
This comment has been minimized.
This comment has been minimized.
|
In this case I'd argue it is firefox's responsibility to ensure the environment variables are a good state. Attempting to auto-detect a VC++ installation when there is already a VC++ configured in the environment can potentially lead to conflicting VC++ versions and bad things happening. |
This comment has been minimized.
This comment has been minimized.
|
@froydnj gah sorry for the regression! Definitely not intentional. The probing logic here has always been... tenuous at best. It's just been a best-effort attempt and has mostly worked up to this point. We'd be more than happy to take a patch to IIRC this is used for cross-compiling in gecko, right? There's an x86_64 rustc but you're building an i686 firefox, which means that rustc may build x86_64 procedural macros (e.g. serde) which would be incorrect if the compiler found the i686 linker for the x86_64 artifact (as that's what the environment is configured to do). If that's the case, I'd imagine three possible solutions here:
I'm fine with any of those solutions, @froydnj do you have a preference? |
This comment has been minimized.
This comment has been minimized.
|
Yeah, all this stuff is required to make the right thing happen on a 64-to-32 cross compilation situation. We wound up unsetting I think we want a more robust solution for the long-term though; when this issue first came up, @alexcrichton outlined several possible solutions, one of which is rust-lang/cargo#3915 and one of which would be modifying I think it's probably easier to make |
This comment has been minimized.
This comment has been minimized.
|
Oh support recently landed in gcc-rs for detecting MSVC 2017 so I think that may be solved now? I'm not sure how bullet-proof the logic may be though so it may need an update! I agree though that the best solution here is likely detecting misconfigured cross-compile scenarios and falling back to rustc's detection at runtime as opposed to using the configured environment. I'll open a dedicated issue for that: #43069 @froydnj if that's the main action item from this issue, should we close this? |
This comment has been minimized.
This comment has been minimized.
|
Thanks for the thorough investigation @froydnj |
brson
added
the
relnotes
label
Jul 7, 2017
This comment has been minimized.
This comment has been minimized.
|
If we don't make any changes here it's still a compat note. For the notes, I think the issue here is that if Does that sound accurate @froydnj ? |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton Yes, I think addressing this on the @brson That release note sounds great. Thanks for writing it up! |
This comment has been minimized.
This comment has been minimized.
|
If Until now, nobody ever gave much thought about what rustc should do when the environment is in a partially configured state, because that's not something which should really happen, either you use vcvars or you don't. I don't think we should try to support partially configured environments because at that point it is a custom configuration and it is the user's responsibility to ensure it is in a sane state. However, I do think we should try to detect when the configured environment doesn't match the target architecture and purge the environment variables. |
retep998 commentedJun 12, 2017
Someone has their environment configured via
start-shell-2015-x64.batso they can build mozilla-central. In stable this worked fine, but in beta this fails with the following error:Because it is a preconfigured environment,
link.exeis definitely inPATHwhich makes the issue more bizarre.