-
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
Enabling target features in .cargo/config does not work for cfg statements in Cargo.toml #6858
Comments
This is an interesting problem. There's a circular requirement where to determine the cfg flags it needs to know the cfg flags. Cargo currently starts with an empty set (see TargetInfo) and runs |
Any updates? |
The same issue seems to affect |
I've just run into this problem when trying to conditionally build I have crafted another minimal reproducer that you can try at https://github.com/daladim/cargo-target-cfg-evaluation-order-bug |
This should be strongly noted in the documentation. It notes I spent around a day trying to set
I don't think this is expected at all. With a config like [target.'cfg(any(windows, unix))']
rustflags = ["-Ctarget-feature=+aes"] I would expect the [target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "my-arm-wrapper"
rustflags = ["…", "…"] |
Adding this limitation to the documentation sounds good to me.
If you are not able to get |
I might be misreading the issue, but I think #10439 was describing the behavior without involvement of Thanks to your answer I tested it a bit further and it appears that rustflags in a Is there another way to query which |
Yea, Unfortunately, I can't think of a workaround to detect those settings from a build script. You could perhaps run |
Originally reported in RustCrypto/stream-ciphers#11
Create a project with following files. Cargo.toml:
.cargo/config:
src/main.rs:
Running
cargo run
outputs "aes disabled" as expected, buteither
crate does not get downloaded, i.e.cfg
statement inCargo.toml
does not work as expected. And as a consequence adding#[cfg(target_feature="aes")] extern crate either;
tomain.rs
results in a compilation error. MeanwhileRUSTFLAGS="-C target-feature=+aes" cargo run
works as expected without any issues.The text was updated successfully, but these errors were encountered: