SIGKILL when compiling packages that use TH on M1-Mac
Summary
I have an M1-Mac with 16GB of RAM and cabal/ghc-8.10.7 installed through ghcup.
Currently I'm not able to compile many packages that use TemplateHaskell. I noticed it first compiling project that uses product-profunctors
, and now also using th-orphans
. However, when I clone those projects and load them interactively (via cabal repl
), they work.
Steps to reproduce
$ cabal repl --build-depends=th-orphans
Resolving dependencies...
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
- th-orphans-0.13.12 (lib) (requires build)
- fake-package-0 (lib) (first run)
Starting th-orphans-0.13.12 (lib)
Building th-orphans-0.13.12 (lib)
cabal: Failed to build th-orphans-0.13.12 (which is required by
fake-package-0). 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).
(the same with --build-depends=product-profunctors
). I have similar problems when I install ghc-9.0.2 or 9.2.2.
However,
$ git clone https://github.com/mgsloan/th-orphans
$ cd th-orphans
$ cabal repl
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
- th-orphans-0.13.12 (lib) (first run)
Preprocessing library for th-orphans-0.13.12..
GHCi, version 8.10.7: https://www.haskell.org/ghc/ :? for help
[1 of 2] Compiling Language.Haskell.TH.Instances.Internal ( src/Language/Haskell/TH/Instances/Internal.hs, interpreted )
[2 of 2] Compiling Language.Haskell.TH.Instances ( src/Language/Haskell/TH/Instances.hs, interpreted )
Ok, two modules loaded.
*Language.Haskell.TH.Instances>
I guess because interpreting works, it's some error thrown when linking or native code generation.
Expected behavior
The package should build without problems.
Environment
- GHC version used: 8.10.7
Optional:
- Operating System: MacOS Monterey 12.2.1
- System Architecture: aarch64 (M1 chip)