The TARGET
environment variable does not point to the file when a target JSON file is used
#8646
Labels
A-build-scripts
Area: build.rs scripts
A-environment-variables
Area: environment variables
A-target-spec
Area: target JSON spec files
C-bug
Category: bug
S-triage
Status: This issue is waiting on initial triage.
Steps
cargo new repro && cd repro
rustc +nightly -Z unstable-options --print target-spec-json --target x86_64-apple-darwin > x86_64-apple-darwin.json
The JSON filename should match the target to avoid some strange cases in the compiler. This should occur on other platforms as well.
Create
build.rs
cargo +nightly build --target $PWD/x86_64-apple-darwin.json -Z build-std --verbose --verbose --verbose
The
build-std
isn't really important to this issue, it's only used to support the non-standard target specification.You'll see the
TARGET
variable no longer has the path and.json
extension in the output:This caused an issue in the rust-lang/rust repository while I was trying to port to
aarch64-apple-darwin
by using a JSON target file. Specifically, indexmap uses autocfg which usesTARGET
to build things.This was failing because my target didn't yet exist in the compiler, so autocfg decided it was the wrong version of
rustc
.Possible Solution(s)
It seems like it should include the full path to the JSON file in the environment variable, but I'm not sure what the impact of such a change would be.
Notes
The text was updated successfully, but these errors were encountered: