-
Notifications
You must be signed in to change notification settings - Fork 24
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
How to provide TARGET_CC/CXX/AR when cross compiling? #165
Comments
Digging a little deeper, I think cc is confused because we're using ldproxy as the RUSTC_LINKER: https://github.com/rust-lang/cc-rs/blob/d69bc7db4493685508a1fecab8b98c5de811bd45/src/lib.rs#L2868 It could also be that we're somehow supposed to make use of the CROSS_COMPILE env variable and somehow modify that big list of targets. I'm really not sure. |
Mistakenly closed, sorry :) |
I discovered that CROSS_COMPILE does indeed work. You need to set CROSS_COMPILE="riscv32-esp-elf" for example to convince cc that it should use that toolchain. Unfortunately what we really need is for |
Exploring an option to patch |
This can be done with rust-lang/cc-rs#776 but I think only for riscv32imc-esp-espidf. The xtensa targets aren't Tier 3 and might not be accepted yet. |
Closing for now as the cc-rs change has been merged for riscv32imc-esp-espidf. We can revisit adding the xtensa targets later. For now, xtensa targets can work around this with:
|
adding a comment here just to say I ran into this and the above solution worked (as well as the solution I managed to arrive at, which was also adding the specific error I got here for google SEO:
|
Bug description
Trying to build any crate that utilizes the cc crate is likely to fail because TARGET_CC/CXX/AR (maybe others) are not set. The toolchain will be defaulted to the host cc which isn't expected to work and gives errors about unknown arguments.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Unsure exactly, I guess I expect cc and other crates to be able to automatically figure out which toolchain to use somehow, though I don't really know how that's supposed to work normally.
Screenshots
N/A
Environment
Additional context
I think this may be a broader problem in the Rust cross compilation ecosystem. Perhaps best we can do is add some notes to the Rust ESP book or troubleshooting section that talk about what to do.
The text was updated successfully, but these errors were encountered: