-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MAKEFLAGS / MFLAGS env vars are set for nmake.exe which breaks it #4156
Comments
The same for VS 2015. Stable cargo builds libz successfully, but recent nightly fails, so all dependent crates are broken now :) It seems, it was happened at 2017-06-09 nightly, because 2017-06-08 one is okay. Working version: Broken:
|
https://github.com/rust-lang/cargo/blob/263548d9/src/cargo/ops/cargo_rustc/context.rs#L111 creates the jobserver, so there's always a jobserver defined. Then this jobserver is used to configure all subcommands, by defining those two env vars on them. I'm not sure it's a good idea to set MAKEFLAGS from cargo since whether make is used or not depends on the build script. Perhaps it would be better to set a CARGO_JOBSERVER env var that build scripts (eg gcc-rs) can then convert to MAKEFLAGS? |
Thanks for the report! This was caused by #4110 and this is also a beta regression for rust-lang/rust so I've filed rust-lang/rust#42635 to track that. It's also worth pointing out that this is not the first time we've run into this, we've had problems when FWIW I've fixed a few projects recently related to this: These can all be classified into a two failure modes so far:
Surprisingly, though, crates which use In any case I see a few paths forward:
I'm personally still leaning towards the former stance. All code already should handle this case (avoiding Currently there is no |
Thanks for explanation. Alex, is it possible to eliminate jobserver feature at all, on "windows-msvc" toolchain? Apparently nobody won't build any crate using mingw or msys under MSVC toolchain, it is impossible. Or I missed something? |
@pravic true yeah that's a possibility. I'd like to integrate the compiler itself into the same jobserver, but this isn't necessary for build scripts. I don't know of any tools that by default on MSVC would use the jobserver, so it's perhaps plausible to exclude MSVC entirely. That being said it's also slightly inconsistent, and it means that non- |
@rust-lang/cargo any thoughts about this regression? Do others feel we should revert the change? |
Looks like fixing build scripts is a proper solution, so I would leave it as is. The release was recently, so if fixing build scripts turns out to be harder then it seems, we could revert later (by the way, this looks like a good example of a case where having a version ( in Cargo.toml or in the index) would likely help us to phase in the change more smoothly, so that all new versions of a crate get better behavior, and old versions get old behavior, without any explicit opt-in or opt-out from crate authors). |
If build scripts need to be changed to accommodate |
Sorry, re-reading @alexcrichton 's comment I now see the scenario of |
@Arnavion ah yeah my thinking is that if you want your crate buildable from That being said, I'd also imagine that the number of build scripts which need to take this into account is relatively small as well... |
I've seen this error all over the place and had to do |
In my opinion cargo should never set environment variables for build scripts that could change behavior without the build script's explicit knowledge. Thus environment variables should always be namespaced, so the build script can opt in to passing that information on to stuff it spawns such as |
Don't set MAKEFLAGS for build scripts Closes #4156 Closes rust-lang/rust#42635
[beta] Don't set MAKEFLAGS for build scripts Closes #4156 Closes rust-lang/rust#42635
Running
cargo install --force cargo-tree
fails with:The reason is that cargo sets the following env vars when invoking libz-sys's build-script-build.exe
which nmake doesn't understand.
I can repro manually by setting up the environment as cargo sets it and running build-script-build.exe, and if I remove those two env vars then build-script-build.exe runs successfully.
The text was updated successfully, but these errors were encountered: