emk / rust-musl-builder

Docker images for compiling static Rust binaries using musl-libc and musl-gcc, with static versions of useful C libraries. Supports openssl and diesel crates.
Apache License 2.0
1.54k stars 193 forks source link

libunwind symbols not found nightly-2019-12-19 #87

Closed drahnr closed 4 years ago

drahnr commented 4 years ago

How could this project be improved?

Add libunwind.

Some nightly versions and cargo require it (tested with:

cargo b
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /home/rust/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/bin/cargo)
Error relocating /home/rust/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/bin/cargo: _Unwind_GetIPInfo: symbol not found
Error relocating /home/rust/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/bin/cargo: _Unwind_GetDataRelBase: symbol not found
Error relocating /home/rust/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/bin/cargo: _Unwind_GetRegionStart: symbol not found
Error relocating /home/rust/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/bin/cargo: _Unwind_SetGR: symbol not found
Error relocating /home/rust/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/bin/cargo: _Unwind_FindEnclosingFunction: symbol not found
Error relocating /home/rust/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/bin/cargo: _Unwind_GetTextRelBase: symbol not found
Error relocating /home/rust/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/bin/cargo: _Unwind_Resume: symbol not found
Error relocating /home/rust/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/bin/cargo: _Unwind_RaiseException: symbol not found
Error relocating /home/rust/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/bin/cargo: _Unwind_GetIP: symbol not found
Error relocating /home/rust/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/bin/cargo: _Unwind_Backtrace: symbol not found
Error relocating /home/rust/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/bin/cargo: _Unwind_GetLanguageSpecificData: symbol not found
Error relocating /home/rust/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/bin/cargo: _Unwind_SetIP: symbol not found
drahnr commented 4 years ago

~So it seems I made a mistake and missed the fact that rustup default nightly-x86_64-unknown-linux-musl updates the toolchain to the latest~ does not update the toolchain, but the dates did not match up, as such another toolchain was installed instead. As such that one was used, including cargo, which now depends on libunwind.

drahnr commented 4 years ago

Actually the issue persists, even after assuring only one toolchain (the tagged one is present).

emk commented 4 years ago

Thank you for the bug report!

Before we release images, we run the scripts hooks/build and hooks/test. The test script compiles and links examples/using-diesel.

Please try taking a fresh rust-musl-builder image and compiling using-diesel as shown in hooks/test. Be careful not to upgrade the Rust toolchain. This should work, but if it doesn't, we'll learn more about the problem.

I've also scheduled two builds of nightly-2020-01-26 (one with OpenSSL 1.0 and one with OpenSSL 1.1). This should allow us to see if using-diesel still links correctly with the latest nightly.

Thank you for your help debugging this!

drahnr commented 4 years ago

I tested as requested and the root cause here was my own fault, I accidentally mapped $HOME/.cargo into the container rather than the registry/git subdir. My apologies for the noise.