Bootstrapping logic has trouble with target triples with dots in the name (e.g. thumbv8m.main-none-eabihf
)
#97263
Labels
C-bug
Category: This is a bug.
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
E-help-wanted
Call for participation: Help is requested to fix this issue.
E-mentor
Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
T-bootstrap
Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Uh oh!
There was an error while loading. Please reload this page.
When running
configure
to cross-compile for a Cortex M target, a few issues arise with the fact that the target has a.
in the name. There are two issues that I noticed:configure.py
generates an invalidconfig.toml
— this is easy to fix with a change to the example file.cc_detect.rs
looks for compiler flags in difficult-to-name variables — this is harder to fix, but can be (painfully) worked around.To illustrate issue 1, I tried this code:
I expected to see this happen: compilation should get pretty far (I'm eliding some of the things that would make it actually succeed, for brevity, but successfully building stage0 rustc is expected at least)
Instead, this happened: compilation fails after one minute with the error:
This is because the generated
config.toml
contains this line (note the problematic period):I believe this comes from here, where we unconditionally replace
x86_64-unknown-linux-gnu
in the exampleconfig.toml
. Ifconfig.toml.example
is updated to put quotes around its target architecture, this issue is solved:Issue 2 takes more effort to reproduce, and is technically not a bug in rustc, but in the
cc
crate. Or maybe it's not a bug at all, but it's pretty darn unfortunate. In particular, the intended way to specifyCFLAGS
(and friends) forthumbv8m.main-none-eabihf
is to write to the environment variableCFLAGS_thumbv8m.main-none-eabihf
, or a few other permutations. The problem: most shells do not allow users to export environment variables that contain the.
character:If I fix issue 1 as described above, and use the workaround described here to get around issue 2, I am able to build a target that has a period in it.
Meta
This was tested with current top of tree (commit
9257f5aad02b65665a6e23e5b92938548302e129
) but does not appear to be a recent regression.I see the same behavior when my host is either
x86_64-apple-darwin
orx86_64-unknown-linux-gnu
, which is unsurprising.I think it makes sense to split issues 1 and 2 into separate bug reports (issue 2 being reported on the
cc
crate) -- but wanted to get this out there first to simply reflect that targets with dots are currently difficult to build for.The text was updated successfully, but these errors were encountered: