I had the same problem building GHC-7.8.2 on a Raspberry Pi: the compiler ran out of memory while doing compiler/main/DynFlags.hs
. But switching off optimisations on that particular step apparently keeps the memory use low enough so it works:
$ "/usr/bin/ghc" -hisuf hi -osuf o -hcsuf hc -static -H32m -O0 -package-conf libraries/bootstrapping.conf -package-name ghc-7.8.2 -hide-all-packages ...
Wheras make
invokes it as ... -static -H32m -O -package-conf ...
.
After that, you can resume the normal (optimised) build of the other modules by running make
again. I suppose the performance doesn't suffer too badly if that one module isn't optimised, in particular since it doesn't look like it really does anything critical – only, it's just really big!
make
is being killed by something (OOM killer?)