Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to build ghc following the directions here: How to install Haskell Platform for Ubuntu 13.04?

I keep getting:

HC [stage 1] compiler/stage2/build/DynFlags.p_o Killed make[1]: ***
[compiler/stage2/build/DynFlags.p_o] Error 137 
make: *** [all] Error 2

I think I'm probably missing a dependency, but I have no idea which.

share|improve this question
While compiling you don't run out of memory? It seems make is being killed by something (OOM killer?) – Salem Sep 30 '13 at 17:37

Yup Salem had it right. It was an OOM issue. I increased the servers RAM from 512MB to 1024MB, and the problem was solved. Thanks!

share|improve this answer

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!

share|improve this answer
Mind, that did not get me through the entire building process... I eventually had to make more memory available anyway (via swap to external HD) when compiler/hsSyn/HsExpr.lhs wouldn't compile even in O0. – leftaroundabout Apr 27 '14 at 17:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.