summary refs log tree commit diff
path: root/pkgs/development/libraries/glibc/default.nix
diff options
context:
space:
mode:
authorNiklas Hambüchen <mail@nh2.me>2019-10-31 02:52:29 +0100
committerGitHub <noreply@github.com>2019-10-31 02:52:29 +0100
commitdef9d09806849d5a3c02d7a856ee26168541743d (patch)
tree73ec9de10d8ea86d82c2dbfba96d2de0d9197f60 /pkgs/development/libraries/glibc/default.nix
parentf73e006509c81b0f0bf9d208fc9f6517e6615ca0 (diff)
parent08ec575c93c00d1751e3a5df55b438073393aa69 (diff)
downloadnixpkgs-def9d09806849d5a3c02d7a856ee26168541743d.tar
nixpkgs-def9d09806849d5a3c02d7a856ee26168541743d.tar.gz
nixpkgs-def9d09806849d5a3c02d7a856ee26168541743d.tar.bz2
nixpkgs-def9d09806849d5a3c02d7a856ee26168541743d.tar.lz
nixpkgs-def9d09806849d5a3c02d7a856ee26168541743d.tar.xz
nixpkgs-def9d09806849d5a3c02d7a856ee26168541743d.tar.zst
nixpkgs-def9d09806849d5a3c02d7a856ee26168541743d.zip
Merge pull request #71480 from nh2/glibc-musl-gcc8-werror-fixes
glibc: Fix building with musl on GCC 8
Diffstat (limited to 'pkgs/development/libraries/glibc/default.nix')
-rw-r--r--pkgs/development/libraries/glibc/default.nix16
1 files changed, 15 insertions, 1 deletions
diff --git a/pkgs/development/libraries/glibc/default.nix b/pkgs/development/libraries/glibc/default.nix
index eda71af5978..50b359da96c 100644
--- a/pkgs/development/libraries/glibc/default.nix
+++ b/pkgs/development/libraries/glibc/default.nix
@@ -40,7 +40,21 @@ callPackage ./common.nix { inherit stdenv; } {
     #      limit rebuilds by only disabling pie w/musl
       ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "pie";
 
-    NIX_CFLAGS_COMPILE = if withGd then "-Wno-error=stringop-truncation" else null;
+    NIX_CFLAGS_COMPILE =
+      if !stdenv.hostPlatform.isMusl
+        # TODO: This (returning a string or `null`, instead of a list) is to
+        #       not trigger a mass rebuild due to the introduction of the
+        #       musl-specific flags below.
+        #       At next change to non-musl glibc builds, remove this `then`
+        #       and the above condition, instead keeping only the `else` below.
+        then (if withGd then "-Wno-error=stringop-truncation" else null)
+        else
+          builtins.concatLists [
+            (stdenv.lib.optional withGd "-Wno-error=stringop-truncation")
+            # Fix -Werror build failure when building glibc with musl with GCC >= 8, see:
+            # https://github.com/NixOS/nixpkgs/pull/68244#issuecomment-544307798
+            (stdenv.lib.optional stdenv.hostPlatform.isMusl "-Wno-error=attribute-alias")
+          ];
 
     # When building glibc from bootstrap-tools, we need libgcc_s at RPATH for
     # any program we run, because the gcc will have been placed at a new