diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index b8064fd4ee79..9d2c4afef217 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -261,6 +261,22 @@ hash = "sha256-L3FQvcm9QB59BOiR2g5/HACAufIG08HiT53EIOjj64g="; }) ] + # Fix build with gcc15 + # https://gitlab.haskell.org/ghc/ghc/-/issues/25662 + # https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13863 + ++ + lib.optionals + ( + lib.versionOlder version "9.12.3" + && !(lib.versionAtLeast version "9.10.2" && lib.versionOlder version "9.12") + ) + [ + (fetchpatch { + name = "ghc-hp2ps-c-gnu17.patch"; + url = "https://src.fedoraproject.org/rpms/ghc/raw/9c26d7c3c3de73509a25806e5663b37bcf2e0b4e/f/hp2ps-C-gnu17.patch"; + hash = "sha256-Vr5wkiSE1S5e+cJ8pWUvG9KFpxtmvQ8wAy08ElGNp5E="; + }) + ] # Fixes stack overrun in rts which crashes an process whenever # freeHaskellFunPtr is called with nixpkgs' hardening flags. # https://gitlab.haskell.org/ghc/ghc/-/issues/25485 diff --git a/pkgs/development/compilers/ghc/common-make-native-bignum.nix b/pkgs/development/compilers/ghc/common-make-native-bignum.nix index 922875e6b4e1..cf9bd6e7e530 100644 --- a/pkgs/development/compilers/ghc/common-make-native-bignum.nix +++ b/pkgs/development/compilers/ghc/common-make-native-bignum.nix @@ -345,6 +345,17 @@ stdenv.mkDerivation ( }) ] + # Fix build with gcc15 + # https://gitlab.haskell.org/ghc/ghc/-/issues/25662 + # https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13863 + ++ lib.optionals (lib.versions.majorMinor version == "9.4") [ + (fetchpatch { + name = "ghc-hp2ps-c-gnu17.patch"; + url = "https://src.fedoraproject.org/rpms/ghc/raw/9c26d7c3c3de73509a25806e5663b37bcf2e0b4e/f/hp2ps-C-gnu17.patch"; + hash = "sha256-Vr5wkiSE1S5e+cJ8pWUvG9KFpxtmvQ8wAy08ElGNp5E="; + }) + ] + ++ [ # Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs # Can be removed if the Cabal library included with ghc backports the linked fix