-
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
-Zhost-config
doesn't apply host.rustflags
to build-script-builds
#10206
Labels
C-bug
Category: bug
Z-host-config
Nightly: host-config
Z-target-applies-to-host
Nightly: target-applies-to-host
Comments
I believe that this is a known bug of |
ehuss
added
Z-host-config
Nightly: host-config
Z-target-applies-to-host
Nightly: target-applies-to-host
labels
Jan 17, 2022
Fix in #10395. |
jonhoo
pushed a commit
to jonhoo/cargo
that referenced
this issue
Feb 18, 2022
bors
added a commit
that referenced
this issue
Feb 28, 2022
Enable propagating host rustflags to build scripts ### What does this PR try to resolve? This PR primarily fixes #10206, but in doing so it also slightly modifies the interface for the unstable `target-applies-to-host` feature (#9453), and adds the unstable `target-applies-to-host-kind` flag to mirror `target-applies-to-host` for build scripts and other host artifacts. The commit messages have more in-depth discussion. ### How should we test and review this PR? The test case from #10206 now works rather than producing an error. It has also been added a regression test case. A few additional test cases have also been added to handle the expected behavior around rustflags for build scripts with and without `target-applies-to-host-kind` enabled. ### Additional information 1. This changes the interface for `target-applies-to-host` so that it does not need to be specified twice to be used. And it can still be set through configuration files using the `[unstable]` table. However, we may(?) want to pick a stable format for in-file configuration of this setting unless we intend for it to only ever be a command-line flag. 2. It may be that `target-applies-to-host-kind` is never behavior we want users to turn on, and that it should therefore simply be removed and hard-coded as being `false`. 3. It's not entirely clear how `target-applies-to-host-kind` should interact with `-Zmultitarget`. If, for example, `requested_kinds = [HostTarget, SomeOtherTarget]` and `kind.is_host()`, should `RUSTFLAGS` take effect or not? For the time being I've just hard-coded the behavior for single targets, and the answer would be "no".
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: bug
Z-host-config
Nightly: host-config
Z-target-applies-to-host
Nightly: target-applies-to-host
Problem
When using
-Zhost-config
to add inrustflags
to apply to the host-only builds, these are still not passed torustc
when building build-scripts.Steps
Possible Solution(s)
I believe the issue is around here, this should be still applying the host rustflags to the build-script builds
cargo/src/cargo/core/compiler/build_context/target_info.rs
Lines 614 to 619 in 263b169
Notes
Originally mentioned on the tracking issue; but after more thought I'm fairly confident this is a bug.
Version
The text was updated successfully, but these errors were encountered: