diff options
author | sternenseemann <sternenseemann@systemli.org> | 2023-03-10 14:15:44 +0100 |
---|---|---|
committer | sternenseemann <sternenseemann@systemli.org> | 2023-03-11 12:22:48 +0100 |
commit | 45aae5c2fec488f0dac3051b840650f7cd274fbb (patch) | |
tree | e86c072eb53fba6dac4584a1bf515c663902d58c /pkgs/development/compilers/ghc/9.2.5.nix | |
parent | 41c538f80f3a98d6e40e7ea5e79f33429850a43e (diff) |
haskell.compiler.ghc9*: work around output cycles on aarch64-darwin
Due to link time dead code elimination not working on aarch64-darwin, some unused store path references in Paths_* modules are retained. This causes reference cycles when a separate `bin` output is used. To prevent this, add a patch to Cabal as shipped by GHC which infers based on the installation layout (which is influenced by enableSeparateBinOutput, enableSeparateDataOutput etc. in a Nix build) which references can be retained without causing a reference cycle. This ensures that packages that were fine with a bin output will also work on aarch64-darwin. Packages that cause a reference cycle anyways (by actually using references that do cause one) fail due to a missing symbol – here we are trading the overall benefit for a more confusing error message. For details, refer to the explanation comment in the patch.
Diffstat (limited to 'pkgs/development/compilers/ghc/9.2.5.nix')
-rw-r--r-- | pkgs/development/compilers/ghc/9.2.5.nix | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pkgs/development/compilers/ghc/9.2.5.nix b/pkgs/development/compilers/ghc/9.2.5.nix index e7c75fcaccf94..b2046479ea8bd 100644 --- a/pkgs/development/compilers/ghc/9.2.5.nix +++ b/pkgs/development/compilers/ghc/9.2.5.nix @@ -203,6 +203,14 @@ stdenv.mkDerivation (rec { extraPrefix = "libraries/Cabal/"; sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY="; }) + ] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [ + # Prevent the paths module from emitting symbols that we don't use + # when building with separate outputs. + # + # These cause problems as they're not eliminated by GHC's dead code + # elimination on aarch64-darwin. (see + # https://github.com/NixOS/nixpkgs/issues/140774 for details). + ./Cabal-3.6-paths-fix-cycle-aarch64-darwin.patch ]; postPatch = "patchShebangs ."; |