-
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
Cargo no longer passes RUSTFLAGS
to build scripts, regression in 1.55.0
#10321
Comments
I was told this is a duplicate of #10111. However, I'm unsure if the solution should really be to "fix" all crates that have been using For once, cargo is unsetting a previously available environment variable here. People rightfully expected a globally exported And they have written their build scripts that way. Is that really what was intended here? |
Ah, I did intend to look for |
Hey @cuviper, thanks for your reply! Would be great if you could have a look and release new 1.0.x and 0.1.x versions soon :) |
@ColinFinck Unfortunately, we were faced with a difficult choice here: we were regularly seeing scripts experiencing breakage when people attempted to pass complex flags. Our choice was between "people experience breakage in unusual cases not seen in testing" and "people see the breakage right away in the common case, and fix it". We ended up opting for the latter. Sorry for the change that resulted in having to adapt build scripts. |
Closing the loop on |
@joshtriplett Thanks for the explanation! |
Problem
I'm building a Rust project via the meta-rust layer in Yocto's BitBake build system for a target platform. Building via Yocto has the effect that vital
RUSTFLAGS
are set and exported before every call tocargo
.In my case, these are:
This is working well for Cargo 1.54.0.
However, my project no longer builds when my Yocto build system is upgraded to Cargo 1.55.0 (and newer releases, tested up to 1.58.0). Instead, it fails with:
num-bigint-dig 0.7.0 is the latest version of that crate and itself depends on autocfg 0.1.5. It comes with a
build.rs
file that runsac.probe_type("i128")
. This is where the build script fails withcan't find crate for std
.Steps
No response
Possible Solution(s)
I have tracked down the problem to this line that got added between Cargo 1.54.0 and 1.55.0:
cargo/src/cargo/core/compiler/custom_build.rs
Line 271 in 58790d3
While that commit also adds a
CARGO_ENCODED_RUSTFLAGS
environment variable (which is probably a good idea), I don't see why you had to removeRUSTFLAGS
from being passed to the build script.Removing that line keeps
RUSTFLAGS
during invocation of the build script and fixes my problem.Notes
No response
Version
No response
The text was updated successfully, but these errors were encountered: