25
votes

When I try to install it with cabal, I get

~$ cabal install ghc-mod
Resolving dependencies...
[1 of 1] Compiling Main             ( /tmp/haskell-src-exts-1.13.5-21238/haskell-src-exts-1.13.5/Setup.hs, /tmp/haskell-src-exts-1.13.5-21238/haskell-src-exts-1.13.5/dist/setup/Main.o )

/tmp/haskell-src-exts-1.13.5-21238/haskell-src-exts-1.13.5/Setup.hs:1:1:
    Warning: In the use of `runTests'
             (imported from Distribution.Simple, but defined in Distribution.Simple.UserHooks):
             Deprecated: "Please use the new testing interface instead!"
Linking /tmp/haskell-src-exts-1.13.5-21238/haskell-src-exts-1.13.5/dist/setup/setup ...
Configuring haskell-src-exts-1.13.5...
Building haskell-src-exts-1.13.5...
Preprocessing library haskell-src-exts-1.13.5...

dist/build/Language/Haskell/Exts/InternalParser.hs:1:12:
    Warning: -fglasgow-exts is deprecated: Use individual extensions instead
[ 1 of 22] Compiling Language.Haskell.Exts.Annotated.Syntax ( src/Language/Haskell/Exts/Annotated/Syntax.hs, dist/build/Language/Haskell/Exts/Annotated/Syntax.o )
cabal: Error: some packages failed to install:
ghc-mod-1.11.1 depends on haskell-src-exts-1.13.5 which failed to install.
haskell-src-exts-1.13.5 failed during the building phase. The exception was:
ExitFailure 9
hlint-1.8.33 depends on haskell-src-exts-1.13.5 which failed to install.

I'm not really sure where to go from here. How can I find out more about why it failed?

edit: I'm using GHC version 7.4.1 and Cabal version 1.14.0

Running Cabal in verbose mode doesn't seem to give any hints except:

...

World file is already up to date.
cabal: Error: some packages failed to install:
ghc-mod-1.11.1 depends on haskell-src-exts-1.13.5 which failed to install.
haskell-src-exts-1.13.5 failed during the building phase. The exception was:
ExitFailure 9
hlint-1.8.33 depends on haskell-src-exts-1.13.5 which failed to install.
1
As with most programs, cabal has a verbose option (-v) and it's always helpful if you include versions of your software (namely, GHC)Thomas M. DuBuisson
Unless I'm mistaken, ExitFailure 9 means that GHC received a SIGKILL (which would explain the lack of any error messages). What kind of system are you running this on? Is there some sort of monitoring app running that would kill GHC for using too much memory or anything like that?hammar
@hammar I'm running Ubuntu server on an Amazon EC2 micro instance. I think you might be right. It uses almost all of the 613 MB RAM when trying to install ghc-mod. Are there any clever ways to get around this?user316146

1 Answers

44
votes

It turned out to be a running-out-of-memory issue, as hammar suspected. I was able to get it to install (although it was painfully slow) by adding a 1GB swap file to the system:

dd if=/dev/zero of=/swapfile bs=1M count=1024
mkswap /swapfile
swapon /swapfile

Apparently EC2 instances come without swap by default.