GHC 9.6.2 -> 9.6.3 regression resulting in SIGKILL on aarch64-darwin
My dear GHC friends,
Something has changed between 9.6.2 and 9.6.3 that leaves GHC unable to compile the statistics
package without receiving SIGKILL
on aarch64-darwin (I have not checked x86_64-darwin).
To reproduce this, start with
$ git clone -b ghc-darwin-sigkill-repro https://github.com/TravisWhitaker/statistics
$ cd ./statistics
$ nix-shell ./shell-962.nix
...
[nix-shell...]$ cabal build
...
# build should succeed
With GHC 9.6.2 we have no trouble. However, with 9.6.3, we have:
$ nix-shell ./shell-963.nix
[nix-shell...]$ cabal build
...
[33 of 49] Compiling Statistics.Types ( Statistics/Types.hs, /Users/twhitaker/sources/statistics/dist-newstyle/build/aarch64-osx/ghc-9.6.3/statistics-0.16.2.1/build/Statistics/Types.o, /Users/twhitaker/sources/statistics/dist-newstyle/build/aarch64-osx/ghc-9.6.3/statistics-0.16.2.1/build/Statistics/Types.dyn_o )
Error: cabal: Failed to build statistics-0.16.2.1. The build process was
killed (i.e. SIGKILL). The typical reason for this is that there is not enough
memory available (e.g. the OS killed a process using lots of memory).
Despite the error message, I measure no extreme memory usage by GHC or child process thereof. The Statistics.Types
module contains Template Haskell; if I remove it manually, I get all the way to the final linking step:
/nix/store/vwh2qqal1q101wv4jy40giavp73q0msd-clang-wrapper-16.0.6/bin/ld: line 269: 41007 Killed: 9 /nix/store/i4sfjfz08vmnrj84asl2j5imakga12za-cctools-binutils-darwin-16.0.6-973.0.1/bin/ld @<(print
f "%q\n" ${extraBefore+"${extraBefore[@]}"} ${params+"${params[@]}"} ${extraAfter+"${extraAfter[@]}"})
clang-16: error: linker command failed with exit code 137 (use -v to see invocation)
`cc' failed in phase `Linker'. (Exit code: 1)
Error: cabal: Failed to build statistics-0.16.2.1.
The fact that we crash on Template Haskell eval and in linking seems like it's not a coincidence. I don't see this with any GHC 9.4.x on aarch64-darwin either.