-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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: Trivial binaries built with musl will fault on nixos #94228
Comments
As per #musl channel on IRC running binaries using the musl libc with the glibc interpreter is not supported. |
I think the Glibc-based stdenv from
The new Nix shell command in unstable nix doesn't automatically pull in stdenv:
|
This also affects non static builds. The most obvious way to compile something with musl, i. e. |
This was mentioned in the original report as well. |
This adds the rust toolchain 1.46.0: https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1460-2020-08-27 Because rustc-1.46.0 enables static PIE by default for `x86_64-unknown-linux-musl` this release will suffer from: #94228 So this commit doesn't remove the 1.45.2 release. This commit also specifies the right LLVM packages to use for each rust release.
This adds the rust toolchain 1.46.0: https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1460-2020-08-27 Because rustc-1.46.0 enables static PIE by default for `x86_64-unknown-linux-musl` this release will suffer from: NixOS#94228 So this commit doesn't remove the 1.45.2 release. This commit also specifies the right LLVM packages to use for each rust release.
I marked this as stale due to inactivity. → More info |
Not stale as far as I can tell :) |
I marked this as stale due to inactivity. → More info |
Still a bug:
|
It also seems to cause the normal
My expectation was that |
For the specific use case of producing static binaries (with musl-clang), this seems to work: sed -i.bak -e 's/-dynamic-linker "\$ldso"//' ld.musl-clang
sed -i.bak -e 's/^sflags=$/sflags="-static"/' musl-clang |
Describe the bug
Running statically linked musl libraries on nixos will fault in early runtime initialization. There appear to be multiple issues, first is that linking on nixos when
PIE
orPIC
is enabled will implicitly also add the glibc ld-linux.so, which causes issues in rust binaries: rust-lang/rust#74757, but it looks like trivial C binaries don’t work either...This is the backtrace:
To Reproduce
Observe that building static binary works:
but if run with a dynamic interpreter, the binary will fault:
Running a dynamically linked binary doesn’t work either (it encodes the same interpreter in its
DT_INTERP
elf metadata):Expected behavior
Binaries linked against musl should work regardless of whether they are linked statically, dynamically or are position independent.
Screenshots
N/A
Additional context
N/A
Notify maintainers
@thoughtpolice @dtzWill
Metadata
"x86_64-linux"
Linux 5.6.16, NixOS, 20.09pre228599.7a07f2a5edd (Nightingale)
yes
yes
nix-env (Nix) 2.3.6
"nixos-20.09pre228599.7a07f2a5edd"
""
/nix/var/nix/profiles/per-user/root/channels/nixos
Maintainer information:
The text was updated successfully, but these errors were encountered: