Skip to content
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

Profile based rustflags generate unknown unstable option: build-std #11275

Closed
Wyvern opened this issue Oct 22, 2022 · 4 comments
Closed

Profile based rustflags generate unknown unstable option: build-std #11275

Wyvern opened this issue Oct 22, 2022 · 4 comments
Labels
C-bug Category: bug

Comments

@Wyvern
Copy link

Wyvern commented Oct 22, 2022

When using some -Z flags in profile based rustflags such as build-std build-std-features panic-in-drop=abort, the compiler generate error unknown unstable option: build-std ....

for example: a customized src profile with rustflags:

[profile.src]
inherits = "release"
panic="abort"
rustflags = ["-Zbuild-std=core,alloc,std,"-Zbuild-std-features=panic_immediate_abort","-Zpanic-in-drop=abort"]
[profile.std.build-override]
inherits = "release"
[profile.std.package."*"]
inherits = "release"

When build using cargo b --profile src the above error raised.

Is it a bug of cargo-features = ["profile-rustflags"] or something else?

@Wyvern Wyvern added the C-bug Category: bug label Oct 22, 2022
@ehuss ehuss transferred this issue from rust-lang/rust Oct 22, 2022
@ehuss
Copy link
Contributor

ehuss commented Oct 22, 2022

Transferred to rust-lang/cargo

rustflags in a profile are flags that apply to rustc. -Zbuild-std is a flag for cargo. Cargo's flags cannot be set from a profile. I recommend using an alias to set which flags to use.

@Wyvern
Copy link
Author

Wyvern commented Oct 22, 2022

Thx @ehuss , that make sense.

Use -Zpanic-in-drop=abort in [profile.src] rustflags combined with set alias src= "build --profile src -Zbuild-std=std... --target <target>" compiler hit error: the crate std is compiled with the panic-in-drop strategy unwind which is incompatible with this crate's strategy of abort.

But, if set -Zpanic-in-drop=abort in [build] rustflags everything works fine. It seems that profile based rustflags wasn't aware of cargo -Zbuild-std flags in this scenario.

@ehuss
Copy link
Contributor

ehuss commented Oct 22, 2022

Indeed that flag does not work in a profile rustflags because profile rustflags are being passed to build scripts. That is one of the concerns registered with the design over on the tracking issue at #10271.

@ehuss
Copy link
Contributor

ehuss commented Dec 11, 2022

I'm going to close, as I don't think cargo will be parsing profile.rustflags to validate the flags. As for the build-script issue, that is an open question on the design tracked in #10271.

@ehuss ehuss closed this as not planned Won't fix, can't repro, duplicate, stale Dec 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants