I try to dynamically link for the musl libc. Static linking works as expected:
cargo new --bin hello rustup target add x86_64-unknown-linux-musl sudo apt install musl-tools musl-dev cargo build --target x86_64-unknown-linux-musl # This works
Following this, I tried to switch to dynamic linking and got the following linker error:
RUSTFLAGS='-C target-feature=-crt-static' cargo build --target x86_64-unknown-linux-musl ... /usr/bin/ld: /usr/bin/ld generated: undefined reference to `pthread_key_create' ... [many more] ...
(Full output here.)
Could anyone help me to find out what I am doing wrong?
The bigger picture is as follows:
I would like to use glium/winit on alpine linux. The winit crate loads the X11 library at runtime (or other libraries depending on the system). So I have to compile my binary with dynamic linking enabled, and I thought that this should actually be straight forward.