Skip to content

Commit

Permalink
pkgsMuslhaskell.compiler.{ghc884,ghc8104}: Use GHC 8.10 as bootstrap …
Browse files Browse the repository at this point in the history
…compiler.

This addresses the fact that `ghc865Binary` segfaults on musl
(see NixOS#118731) because of the glibc+musl mix used in there.

With the previous commits, `ghc8102Binary` was changed to use
the musl-based bindist from GHC HQ instead, which works.

With this change, all nix Haskell compilers builds on musl:

    NIX_PATH=nixpkgs=. nix-build --no-link --expr 'with import <nixpkgs> {}; { inherit (pkgsMusl.haskell.compiler) ghc884 ghc8104 ghc901 ghcHEAD; }'
  • Loading branch information
nh2 committed Jul 5, 2021
1 parent d1c469c commit 85b34b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 7 additions & 4 deletions pkgs/development/compilers/ghc/8.8.4.nix
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,14 @@ stdenv.mkDerivation (rec {
postPatch = "patchShebangs .";

# GHC is a bit confused on its cross terminology.
preConfigure = lib.optionalString stdenv.isAarch64 ''
preConfigure =
# Aarch64 allow backward bootstrapping since earlier versions are unstable.
find . -name \*\.cabal\* -exec sed -i -e 's/\(base.*\)4.14/\14.16/' {} \; \
-exec sed -i -e 's/\(prim.*\)0.6/\10.8/' {} \;
'' + ''
# Same for musl, as earlier versions do not provide a musl bindist for bootstrapping.
lib.optionalString (stdenv.isAarch64 || stdenv.hostPlatform.isMusl) ''
find . -name \*\.cabal\* -exec sed -i -e 's/\(base.*\)4.14/\14.16/' {} \; \
-exec sed -i -e 's/\(prim.*\)0.6/\10.8/' {} \;
''
+ ''
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
export "''${env#TARGET_}=''${!env}"
done
Expand Down
6 changes: 4 additions & 2 deletions pkgs/top-level/haskell-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ in {

ghc884 = callPackage ../development/compilers/ghc/8.8.4.nix {
# aarch64 ghc865Binary gets SEGVs due to haskell#15449 or similar
bootPkgs = if stdenv.isAarch64 then
# Musl bindists do not exist for ghc 8.6.5, so we use 8.10.* for them
bootPkgs = if stdenv.isAarch64 || stdenv.targetPlatform.isMusl then
packages.ghc8102BinaryMinimal
else
packages.ghc865Binary;
Expand All @@ -67,7 +68,8 @@ in {
};
ghc8104 = callPackage ../development/compilers/ghc/8.10.4.nix {
# aarch64 ghc865Binary gets SEGVs due to haskell#15449 or similar
bootPkgs = if stdenv.isAarch64 || stdenv.isAarch32 then
# Musl bindists do not exist for ghc 8.6.5, so we use 8.10.* for them
bootPkgs = if stdenv.isAarch64 || stdenv.isAarch32 || stdenv.targetPlatform.isMusl then
packages.ghc8102BinaryMinimal
else
packages.ghc865Binary;
Expand Down

0 comments on commit 85b34b1

Please sign in to comment.