7
votes

I am trying to install a Hamlet on a webfaction shared server so I can compile and run my web application there. I am using Yesod to develop the application.

I managed to compile GHC 7 from source and bootstrapped cabal install. Next I did cabal install hamlet and expected it to work. No luck!

I get the following strange error message from cabal/GHC. Could anyone help me out?

$ cabal install hamlet                       Resolving dependencies...
Configuring hamlet-0.8.2...
Preprocessing library hamlet-0.8.2...
Building hamlet-0.8.2...
[ 1 of 14] Compiling Text.MkSizeType  ( Text/MkSizeType.hs, dist/build/Text/MkSizeType.o )
[ 2 of 14] Compiling Text.Shakespeare ( Text/Shakespeare.hs, dist/build/Text/Shakespeare.o )
[ 3 of 14] Compiling Text.Hamlet.Parse ( Text/Hamlet/Parse.hs, dist/build/Text/Hamlet/Parse.o )

Text/Hamlet/Parse.hs:113:13:
    Warning: A do-notation statement discarded a result of type String.
         Suppress this warning by saying "_ <- ($) try string "!--"",
         or by using the flag -fno-warn-unused-do-bind
[ 4 of 14] Compiling Text.Hamlet.Quasi ( Text/Hamlet/Quasi.hs, dist/build/Text/Hamlet/Quasi.o )
[ 5 of 14] Compiling Text.Css         ( Text/Css.hs, dist/build/Text/Css.o )
[ 6 of 14] Compiling Text.Cassius     ( Text/Cassius.hs, dist/build/Text/Cassius.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.3.0.2 ... linking ... done.
Loading package containers-0.4.0.0 ... linking ... done.
Loading package pretty-1.0.1.2 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package filepath-1.2.0.0 ... linking ... done.
Loading package old-locale-1.0.0.2 ... linking ... done.
Loading package old-time-1.0.0.6 ... linking ... done.
Loading package unix-2.4.2.0 ... linking ... done.
Loading package directory-1.1.0.0 ... linking ... done.
Loading package process-1.0.1.5 ... linking ... done.
Loading package bytestring-0.9.1.10 ... linking ... done.
Loading package transformers-0.2.2.0 ... linking ... done.
Loading package mtl-2.0.1.0 ... linking ... done.
Loading package parsec-3.1.1 ... linking ... done.
Loading package failure-0.1.0.1 ... linking ... done.
Loading package deepseq-1.1.0.2 ... linking ... done.
Loading package text-0.11.0.8 ... linking ... done.
Loading package blaze-builder-0.3.0.1 ... linking ... done.
Loading package blaze-html-0.4.1.1 ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
ghc: mmap 36864 bytes at (nil): Operation not permitted
ghc: Try specifying an address with +RTS -xm<addr> -RTS
cabal: Error: some packages failed to install:
hamlet-0.8.2 failed during the building phase. The exception was:
ExitFailure 1
1
Just out of curiosity, why did you install GHC from source? Might it have caused the problem?Tarrasch
I had to do that because the generic GHC 7 binary did not work on webfaction while 6.12 binary did. I don't remember what the exact error was but I tried compiling GHC 7 from source and it worked painlessly.Anupam Jain
Okay I just did an installation of GHC on a different (local) machine and I just realised why the binary distribution of GHC did not work. After I installed the binary GHC, I got the error - configure: error: Your installation of ghc does not appear to work. It cannot compile a simple program (see config.log for the details). If you installed ghc from a generic binary tarball then it is worth checking that you have the 'gmp' C library and header files installed. (On Debian-based systems this package is called libgmp3-dev.) Installing from source fixed that.Anupam Jain
This does not seem to be webfaction or Hamlet specific. I am getting: Loading package transformers-0.4.3.0 ... ghc: mmap 1400832 bytes at (nil): Operation not permitted ghc: Try specifying an address with +RTS -xm<addr> -RTS Failed to install vector-0.10.12.3 on a Debian laptop. This is cabal sandbox.stf

1 Answers

8
votes

Okay I seem to have solved the problem and am noting it here in the hope that it helps others.

The problem is that webfaction does not allow you to execute files stored in /tmp. The error message from cabal is very decidedly confusing.

The fix is to set the environment variable to a directory in your homepath (where no such restriction applies) before running cabal install. I simply created an alias -

alias cabalinstall='export TMPDIR=~/tmp; cabal install'

This makes sure that the tmpdir is set correctly before trying to install any cabal package.