-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Staticlib built with musl linking problems in Ruby gem #37007
Comments
Thanks for the report! Unfortunately this may not be a case that works today. Right now the Rust compiler expects the musl target to be linked statically, so the staticlib you've produced actually has all of libc.a (musl's version) included in it. This means that when it's linked into a shared object that conflicts with musl's dynamic library version of libc (libc.so) and wreaks all kind of havoc (including the weird error you're seeing). Note, though, that there's an RFC (rust-lang/rfcs#1721) about customizing this, so if that lands it'd just be |
@alexcrichton thanks for the response! Too bad it doesn't work yet, at least I now know why :) I'll be happy to run some tests once there's a alpha/beta release with support. I'm subscribed to the rfcs issue and have my own issue for this problem in a private repo. You can close this issue if needed. |
This is what we're doing for Skylight: https://users.rust-lang.org/t/linking-problems-in-ruby-gem-using-a-rust-staticlib/7467/2?u=wagenet. It works fine for non-musl and in my basic testing appears to work for musl, but some testers have reported issues. I'm still investigating. |
@wagenet oh right, thanks for the info! Your use case though is opening a musl dylib in a glibc process, right? (or am I misremembering). If that's the case, then this is slightly different in the sense that it's a musl dylib in a musl process, but the point still stands! |
@tombruijn states here that this is fixed, closing. |
Hi!
I tried to build a staticlib to the
x86_64-unknown-linux-musl
target, with the std included and libc dependency.It compiles without errors.
However, when adding it as a dependency to a Ruby gem on alpine linux it throws an error:
Meta
Example project
I'm using a docker container to build the staticlib. An example project with the full process automated and documented can be found here: https://github.com/tombruijn/rust_example
It builds the staticlib on a ubuntu 16 machine with musl-tools installed and set to use musl during compilation.
Things of note:
debian
branch in the example repo)Anyone knows what is going wrong here?
The text was updated successfully, but these errors were encountered: