-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
build.rs should ignore RUSTFLAGS #6375
Comments
I'm still getting output:
full output: https://pastebin.com/raw/0fPA4Mhz |
@elichai It looks like |
How can I do that without editing Cargo.toml? (i.e. I have a script that adds |
Config profiles support that, but unfortunately they are unstable/unfinished.
|
* Update nightly in CI See rust-lang/rust#70175 and rust-lang/cargo#6375 * Bump minimum rust version to 1.43.1 * Add rustdocflags * Bump grcov version
* Update nightly in CI See rust-lang/rust#70175 and rust-lang/cargo#6375 * Bump minimum rust version to 1.43.1 * Add rustdocflags * Bump grcov version
* Update nightly in CI See rust-lang/rust#70175 and rust-lang/cargo#6375 * Bump minimum rust version to 1.43.1 * Add rustdocflags * Bump grcov version
To avoid to compile `build.rs` wrongly. Without this it will be compiled with `kernel.ld` as specified in `.cargo/config.toml`. See rust-lang/cargo#6375 (comment).
Without specifying a target, `build.rs` will also be compiled with the same codegen options. See: rust-lang/cargo#6375 (comment)
Without specifying a target, `build.rs` will also be compiled with the same codegen options. See: rust-lang/cargo#6375 (comment)
For anyone else who hits the issue, the workaround is to
Note that this does not work with |
Here I am putting a minimal example I have that gives this problem (that is reproducible on a Ubuntu machine, rustc // build.rs
fn main(){
println!("Hello world!");
let version = "rustc 1.70.0 1-(05".to_owned();
let nightly = version.contains("dev");
println!("End of world!");
} // .cargo/config.toml
[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "target-feature=+avx512f"] The problem goes away if you change version to let version = "rustc 1.70.0 1-".to_owned(); |
RUSTFLAGS is passed to build.rs scripts and results in error: lto can only be run for executables, cdylibs and static library outputs Upstream issue: <rust-lang/cargo#6375>
Problem
build.rs is compiled with RUSTFLAGS if target is not specified.
The problem here is that if a user compiles for a newer CPU than they have, build script can potentially use newer instructions and fail with SIGILL.
Steps
1.cargo new test-build
2.cd test-build
3.touch build.rs
4.cargo build -vv
Possible Solution(s)
I don't have a solution, but it seems like env_args() is the problem.
Notes
Output of
cargo version
:cargo 1.30.0 (a1a4ad3 2018-11-02)
The text was updated successfully, but these errors were encountered: