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
This commit is contained in:
Adam Joseph 2023-04-05 22:26:01 -07:00
parent 6afd316cbc
commit 3778e07994

View File

@ -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.