summary refs log tree commit diff
path: root/pkgs/stdenv/linux
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2023-04-05 22:26:01 -0700
committerAdam Joseph <adam@westernsemico.com>2023-04-06 03:16:31 -0700
commit3778e07994ec7727aa40d70420bce1ec504d6168 (patch)
tree52075973db98c1125032af0692333a75d72e4c3d /pkgs/stdenv/linux
parent6afd316cbc14071bcb099ae5705d9b8fc9a3427c (diff)
downloadnixpkgs-3778e07994ec7727aa40d70420bce1ec504d6168.tar
nixpkgs-3778e07994ec7727aa40d70420bce1ec504d6168.tar.gz
nixpkgs-3778e07994ec7727aa40d70420bce1ec504d6168.tar.bz2
nixpkgs-3778e07994ec7727aa40d70420bce1ec504d6168.tar.lz
nixpkgs-3778e07994ec7727aa40d70420bce1ec504d6168.tar.xz
nixpkgs-3778e07994ec7727aa40d70420bce1ec504d6168.tar.zst
nixpkgs-3778e07994ec7727aa40d70420bce1ec504d6168.zip
stdenv: fix pkgsMusl
I broke `pkgsMusl` with #209870.

Something odd is happening with `xgcc` (the temporary compiler that
should be used only to compile `gcc`, although we are using it to
compile a temporary `patchelf` too) and `libstdc++`.

The temporary fix in this commit is to use `-static-libstdc++` for
the ephemeral `patchelf` built by `xgcc`.  It isn't pretty, but it
appears to work.

Incorporates:

- https://github.com/NixOS/nixpkgs/pull/224945
Diffstat (limited to 'pkgs/stdenv/linux')
-rw-r--r--pkgs/stdenv/linux/default.nix8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index ddfbc11b640..e227b685077 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -458,6 +458,14 @@ in
           '';
         };
       };
+
+      # TODO(amjoseph): It is not yet entirely clear why this is necessary.
+      # Something strange is going on with xgcc and libstdc++ on pkgsMusl.
+      patchelf = super.patchelf.overrideAttrs(previousAttrs:
+        lib.optionalAttrs super.stdenv.hostPlatform.isMusl {
+          NIX_CFLAGS_COMPILE = (previousAttrs.NIX_CFLAGS_COMPILE or "") + " -static-libstdc++";
+        });
+
     };
 
     # `libtool` comes with obsolete config.sub/config.guess that don't recognize Risc-V.