-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
rust-lld doesn't support libraries with zlib-compressed debug info #130063
Comments
The error seems to suggest this is about zlib compressed debuginfo, nothing related to staticlibs. |
Fair, sorry for misleading title and description. I think that fix would still remain the same (enabling zlib in LLVM builds). |
As you discovered, Support is not as principled as when we enable See for example, on the latest $ rustc -Vv
rustc 1.83.0-nightly (adf8d168a 2024-09-08)
binary: rustc
commit-hash: adf8d168af9334a8bf940824fcf4207d01e05ae5
commit-date: 2024-09-08
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0
$ ldd $(rustup which rustc) | grep libz
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ffff7bfe000) And an example showing it working, on a helloworld: $ cargo clean -q && RUSTFLAGS="-Zdebuginfo-compression=zlib" cargo build -q && readelf -t target/debug/helloworld | grep Z
ZLIB, 0000000000001d67, 1
ZLIB, 00000000000f722e, 1
ZLIB, 00000000000072b0, 1
ZLIB, 00000000000a1660, 1
ZLIB, 00000000001481db, 1
ZLIB, 0000000000063e78, 1 Remember that we use $ readelf -p .comment target/debug/helloworld
String dump of section '.comment':
[ 1] Linker: LLD 19.1.0 (/checkout/src/llvm-project/llvm 2b259b3c201f939f2ed8d2fb0a0e9b37dd2d1321)
[ 5f] GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
[ 8a] rustc version 1.83.0-nightly (adf8d168a 2024-09-08) So |
I didn't test #130471 but it should fix this |
Add zlib to musl dist image so rust-lld will support zlib compression for debug info there. Fixes rust-lang#130063. r? `@Kobzol`
Rollup merge of rust-lang#130471 - khuey:zlib-musl, r=Kobzol Add zlib to musl dist image so rust-lld will support zlib compression for debug info there. Fixes rust-lang#130063. r? `@Kobzol`
rust-lld which is shipped in rustup toolchains doesn't include zlib support. That leads to issues if it tries to link static libraries which are compressed.
In my case, I'm trying to build a crate on Alpine Linux, where
/usr/lib/libc.a
is compressed wit zlib.(I also had to specify
-L /lib -L /usr/lib
in my RUSTFLAGS to even be able to find the library, but that's a separate issue - #130062)I think that could be fixed by enabling
LLVM_ENABLE_ZLIB
CMake option by default.The text was updated successfully, but these errors were encountered: