-
Notifications
You must be signed in to change notification settings - Fork 708
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
musl/amd64: relocation R_X86_64_32 against hidden symbol can not be used when making a shared object #544
Comments
I've spent a bit more time looking into this, and after several wrong leads I now think that this due to rustc static-linking assumption about the musl target, resulting in an hardcoded
I'm currently playing with just appending a |
@lucab I tried building your project's ups/hyper-rustls branch like this: cargo build --target x86_64-unknown-linux-musl --release --example trace It worked fine with no changes to ring or gcc-rs. Your |
I am still skeptical of the approach of using |
Meh, a typo slipped in the branch name (s/wip/ups/) I updated the initial comment. master is using a forked ring repo with the fix in #549, so that it doesn't fail. I understand you are still skeptical and I'm sorry I don't have the full knowledge to answer you. My current understanding is that statically linking the final binary results in combining together objects from multiple rlibs and my own binary object, but some combinations are not valid. But your questions are on spot, and the final binary is indeed weird:
I'm now waiting for the next release of gcc-rs with rust-lang/cc-rs#167 to make some more experiments. |
Indeed, it looks like something fishy was going on with this cargo cross-building. In particular, it looks like even with I tried reverting to vanilla ring and just tweaking my cross-linker options locally in
I think this is the proper fix instead of #549, so I'm going to close that PR and just stick to a local config override. This bug can be closed as well, or it can be addressed by a small doc section like "In case of cross-compilation issue, make sure that the proper cross-toolchain binaries are configured and used", somewhere. |
It looks like I'm not the first one stepping on this: rust-lang/rust#40049 (comment), rust-lang/cargo#4133. |
Thanks lucab. I agree that the errors can be very confusing if you don't override the linker. Thanks for filling in the missing details! |
Trying to build a project which depends on ring (current release, 0.9.7) for musl-amd64 target fails at linktime with a relocation error.
The environment is an up-to-date debian stretch (next stable), with musl 1.1.16, ld.bfd 2.28 and rustc 1.17.0.
This can be reproduced by building any of the examples from this wip branch:
The text was updated successfully, but these errors were encountered: