From ccc08ba453b87d69a5d1be7cd86ea0fa908e55e9 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Thu, 21 Mar 2024 20:04:55 +0100 Subject: [PATCH] haskell.compiler.{ghc98*,ghcHEAD}: bootstrap using source built 9.6 Unfortunately, we are running into trouble linking dependencies of hadrian against the libraries of the clock package with 9.6.3 and 9.6.4 _bindists_. My current suspiscion is that this is caused by some kind of discrepancy between the toolchain used by GHC upstream and us that persists from the configure step used when building the bindist. The problem seems to be somewhat localized to hsc2hs (hence clock is an issue), with GHC 9.6.4 bindists even passing a flag to ld that is not supported by our version of cctools. The problem is not fully diagnosed, so take the speculation above with a grain of salt. As a workaround, we can use the source built GHC 9.6 which is, of course, configured with our toolchain in the environment. --- .../compilers/ghc/9.6.3-binary.nix | 3 +++ pkgs/top-level/haskell-packages.nix | 21 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/pkgs/development/compilers/ghc/9.6.3-binary.nix b/pkgs/development/compilers/ghc/9.6.3-binary.nix index f8916d712b16..b8ad3c1192eb 100644 --- a/pkgs/development/compilers/ghc/9.6.3-binary.nix +++ b/pkgs/development/compilers/ghc/9.6.3-binary.nix @@ -403,5 +403,8 @@ stdenv.mkDerivation rec { # `pkgsMusl`. platforms = builtins.attrNames ghcBinDists.${distSetName}; maintainers = lib.teams.haskell.members; + # packages involving hsc2hs (clock) produce libraries our + # ld can't link against + broken = stdenv.hostPlatform.isDarwin; }; } diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index b757c630420f..b0c098ddcaa8 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -298,6 +298,13 @@ in { packages.ghc963 else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then packages.ghc963 + else if stdenv.hostPlatform.isDarwin then + # it seems like the GHC 9.6.* bindists are built with a different + # toolchain than we are using (which I'm guessing from the fact + # that 9.6.4 bindists pass linker flags our ld doesn't support). + # With both 9.6.3 and 9.6.4 binary it is impossible to link against + # the clock package (probably a hsc2hs problem). + packages.ghc963 else packages.ghc963Binary; inherit (buildPackages.python3Packages) sphinx; @@ -316,6 +323,13 @@ in { packages.ghc963 else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then packages.ghc963 + else if stdenv.hostPlatform.isDarwin then + # it seems like the GHC 9.6.* bindists are built with a different + # toolchain than we are using (which I'm guessing from the fact + # that 9.6.4 bindists pass linker flags our ld doesn't support). + # With both 9.6.3 and 9.6.4 binary it is impossible to link against + # the clock package (probably a hsc2hs problem). + packages.ghc963 else packages.ghc963Binary; inherit (buildPackages.python3Packages) sphinx; @@ -335,6 +349,13 @@ in { packages.ghc963 else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then packages.ghc963 + else if stdenv.hostPlatform.isDarwin then + # it seems like the GHC 9.6.* bindists are built with a different + # toolchain than we are using (which I'm guessing from the fact + # that 9.6.4 bindists pass linker flags our ld doesn't support). + # With both 9.6.3 and 9.6.4 binary it is impossible to link against + # the clock package (probably a hsc2hs problem). + packages.ghc963 else packages.ghc963Binary; inherit (buildPackages.python3Packages) sphinx;