-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cannot build statically linked cargo on musl with RUSTFLAGS="-C target-feature=+crt-static" #5266
Comments
The issue seems to be fixable in this function. https://sourcegraph.com/github.com/rust-lang/cargo@5a6b69276c050c92a6fa4865a1ca1e989c361431/-/blob/src/cargo/core/compiler/build_context/target_info.rs#L156:12-156:22 |
Who understands whether we can set |
I've tried that but it requires PIE or PIC literally on everything and it's supper messy. |
Is there documentation about this requirement somewhere? What can others do to gain more understanding of this challenge? |
I'm not aware of any docs, once you change it to true you will get dozens of build errors about relocations. |
What about creating a WIP PR replicating your experiment, so that others can see the build log and discuss the problem? Or is there a better way forward? |
@sanmai-NL musl does not support
|
AFAIK the procedural macros DSO isn't being linked into a program produced, but loaded by the compiler when compiling the program. Could we make the logic more sophisticated for building procedural macro crates, so that they don't depend on |
@sanmai-NL you will want to link dynamically all the time when using it as the host toolchain. In rust-lang/rust#58575 I proposed new triple:
I'll open issue to track musl related things soon. |
@mati865 Can this issue be closed now? |
@ehuss I'm no longer actively using musl target but I suppose it's fixed. |
OK, I'm going to close. I believe the default on nightly musl is +crt-static, but not for proc-macros (via rust-lang/rust#69519). I think specifying it as an explicit arg still overrides the proc-macro, so probably don't need to explicitly specify |
It does not work since cargo 0.18.0, there were no problem with static build in 0.17.0.
The text was updated successfully, but these errors were encountered: