-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Failure to locate link.exe in preconfigured environment #42607
Comments
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 |
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. |
@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? |
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 |
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? |
Thanks for the thorough investigation @froydnj |
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 ? |
@alexcrichton Yes, I think addressing this on the @brson That release note sounds great. Thanks for writing it up! |
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. |
Someone has their environment configured via
start-shell-2015-x64.bat
so 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.exe
is definitely inPATH
which makes the issue more bizarre.The text was updated successfully, but these errors were encountered: