diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index 2b66c97aa3ae..405d8eafc91c 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -696,6 +696,11 @@ stdenv.mkDerivation ( configureFlags = [ "--datadir=$doc/share/doc/ghc" ] + # ghc 9.10 and later use c17 by default. we use gnu17 on darwin for older + # ghc versions to match this and fix build issues with newer clang. + ++ lib.optionals (hostPlatform.isDarwin && lib.versionOlder version "9.10") [ + "CFLAGS=-std=gnu17" + ] ++ lib.optionals enableTerminfo [ "--with-curses-includes=${lib.getDev targetLibs.ncurses}/include" "--with-curses-libraries=${lib.getLib targetLibs.ncurses}/lib" diff --git a/pkgs/development/compilers/ghc/common-make-native-bignum.nix b/pkgs/development/compilers/ghc/common-make-native-bignum.nix index 84df764cbcc3..66925f9613ac 100644 --- a/pkgs/development/compilers/ghc/common-make-native-bignum.nix +++ b/pkgs/development/compilers/ghc/common-make-native-bignum.nix @@ -501,6 +501,11 @@ stdenv.mkDerivation ( configureFlags = [ "--datadir=$doc/share/doc/ghc" ] + # ghc 9.10 and later use c17 by default. we use gnu17 on darwin for older + # ghc versions to match this and fix build issues with newer clang. + ++ lib.optionals (hostPlatform.isDarwin && lib.versionOlder version "9.10") [ + "CFLAGS=-std=gnu17" + ] ++ lib.optionals enableTerminfo [ "--with-curses-includes=${lib.getDev targetLibs.ncurses}/include" "--with-curses-libraries=${lib.getLib targetLibs.ncurses}/lib"