-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
pkgsStatic
shouldn't imply musl.
#196329
Comments
It looks like this is all that should be needed to make the pkgsStatic package set use static glibc. --- a/pkgs/top-level/stage.nix
+++ b/pkgs/top-level/stage.nix
@@ -250,7 +250,6 @@ let
extend = f: self.appendOverlays [f];
# Fully static packages.
- # Currently uses Musl on Linux (couldn’t get static glibc to work).
pkgsStatic = nixpkgsFun ({
overlays = [ (self': super': {
pkgsStatic = super';
@@ -258,9 +257,7 @@ let
} // lib.optionalAttrs stdenv.hostPlatform.isLinux {
crossSystem = {
isStatic = true;
- parsed = makeMuslParsedPlatform stdenv.hostPlatform.parsed;
- } // lib.optionalAttrs (stdenv.hostPlatform.system == "powerpc64-linux") {
- gcc.abi = "elfv2";
+ parsed = stdenv.hostPlatform.parsed;
};
});
}; This currently fails to build static glibc during stdenv bootstrap. |
Note that static linking the glibc can lead to various weird bugs and is generally discouraged, see https://stackoverflow.com/a/57478728, and look through the libc manual for "statically link" and "static link". The wiki also has a FAQ about this. musl seems a better choice for static linking. |
I don't see any language discouraging static linking in the libc manual. The caveats of static linking mentioned in that stackoverflow post are noted, but they aren't major IMO and don't seem like showstoppers for someone desiring a static distribution. |
Yeah that's a good point, in practice static binaries using glibc tend to be statically linked against their libraries except for glibc. It's still a usecase that is covered better by having a package set, rather than overriding the specific package you want to have static binaries for. |
cc @NixOS/static |
Describe the bug
pkgsStatic
switches the libc from the default glibc to musl. But musl has its own pkgs overlay, that should compose withpkgsStatic
. Currently it does not: #114510.See also #136549 (comment):
The text was updated successfully, but these errors were encountered: