Warning
This post was published 33 days ago. The information described in this article may have changed.
Hi colleagues,
Do you also run into hacks when cross-compiling? For example, if a project has a dependency on proc-macros, do you end up with at least two separate .cargo/config.toml
files - one for development and one for release?
The issue is that you can't build a static binary for any target from an x86_64
host when your config includes something like this:
[target.x86_64-unknown-linux-gnu]
linker = "compilers/cc-x86_64-linux-gnu"
rustflags = ["-C", "link-self-contained=no", "-C", "target-feature=+crt-static"]
Because proc-macros
must be compiled for the host target, and this setup forces everything - including proc-macros
- to be built with the overridden linker, which breaks the build.
3 posts - 1 participant
🏷️ rust_feed