Skip to content

Test building custom targets and resolve an issue probing rustc #970

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

Merged
merged 1 commit into from
Jul 5, 2025

Conversation

tgross35
Copy link
Contributor

@tgross35 tgross35 commented Jul 5, 2025

The rustc probe done in our build scripts needs to pass --target to
get the correct configuration, which usually comes from the TARGET
environment variable. However, for targets specified via a target.json
file, TARGET gets set to the file name without an extension or path.
rustc will check a search path to attempt to locate the file, but this
is likely to fail since the directory where Cargo invokes build scripts
(and hence where those scripts invoke rustc) might not have any
relation to the JSON spec file.

Resolve this for now by leaving f16 and f128 disabled if the rustc
command fails. Result of the discussion at CARGO-14208 may eventually
provide a better solution.

A CI test is also added since custom JSON files are an edge case that
could fail in other ways. I verified this fails without the fix here.
The JSON file is the output for thumbv7em-none-eabi, just renamed so
rustc doesn't identify it.

@tgross35 tgross35 force-pushed the fix-custom-target branch 3 times, most recently from 9ca7153 to 2fbd5c9 Compare July 5, 2025 01:59
@tgross35 tgross35 changed the title Fix builds with custom targets Test building custom targets and resolve an issue probing rustc Jul 5, 2025
@tgross35 tgross35 changed the title Test building custom targets and resolve an issue probing rustc Test building custom targets and resolve an issue probing rustc Jul 5, 2025
@tgross35 tgross35 force-pushed the fix-custom-target branch from 2fbd5c9 to 5ccd53c Compare July 5, 2025 02:00
The `rustc` probe done in our build scripts needs to pass `--target` to
get the correct configuration, which usually comes from the `TARGET`
environment variable. However, for targets specified via a `target.json`
file, `TARGET` gets set to the file name without an extension or path.
`rustc` will check a search path to attempt to locate the file, but this
is likely to fail since the directory where Cargo invokes build scripts
(and hence where those scripts invoke `rustc`) might not have any
relation to the JSON spec file.

Resolve this for now by leaving `f16` and `f128` disabled if the `rustc`
command fails. Result of the discussion at CARGO-14208 may eventually
provide a better solution.

A CI test is also added since custom JSON files are an edge case that
could fail in other ways. I verified this fails without the fix here.
The JSON file is the output for `thumbv7em-none-eabi`, just renamed so
`rustc` doesn't identify it.
@tgross35 tgross35 force-pushed the fix-custom-target branch from 5ccd53c to 8aba4c8 Compare July 5, 2025 02:10
@tgross35 tgross35 merged commit 8aba4c8 into rust-lang:master Jul 5, 2025
36 checks passed
@tgross35 tgross35 deleted the fix-custom-target branch July 5, 2025 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant