Question

I am new to Haskell, and wanted to play around with snap framework. Unfortunately I just cant get the thing to compile. I've tried (all I know too), updating cabal and running sudo ghc-pkg recache but I still get the following when I run cabal install snap. Please help.

12 warnings and 1 error generated.
Failed to install binary-0.7.1.0
cabal: Error: some packages failed to install:
SHA-1.6.4 depends on binary-0.7.1.0 which faile
d to install.
binary-0.7.1.0 failed during the building phase
. The exception was:
ExitFailure 1
pwstore-fast-2.4.1 depends on binary-0.7.1.0 wh
ich failed to install.
snap-0.13.2.2 depends on binary-0.7.1.0 which f
ailed to install.

Solution:

I first install the 'real' gcc via homebrew like so:

brew update
brew install gcc47

This took a while to install (as in over an hour). Once it was done I updated the GHC settings to use the copy of gcc installed by homebrew.

GHC settings are located either here :

/Library/Frameworks/GHC.framework/Versions/Current/usr/lib/ghc-7.6.3/settings

or here if you installed ghc with homebrew (I did not).

/usr/local/Cellar/ghc/7.6.3/lib/ghc-7.6.3/settings

Update the line

("C compiler command", "/usr/bin/gcc")

to

("C compiler command", "/usr/local/Cellar/gcc47/4.7.3/bin/gcc-4.7")

Then just run

 cabal update && cabal install snap

and all should be well. :)

Was it helpful?

Solution

Your problem is that the binary package has some C preprocessor constructs that are not strictly valid.

After looking around a bit, I found a similar problem somebody had when installing the Haskell platform. It seems the core issue is that the Clang C preprocessor is stricter than the GCC one most Haskellers use. I'm assuming that this is your problem: you're using Clang rather than GCC. If you're on OS X, this is the default choice.

The easiest solution seems to be to switch to using GCC for the preprocessing. Note that on OS X, /usr/bin/gcc actually points to Clang! You will need to point GHC to an actual install of GCC.

You can do this by editing GHC's configuration file. On my system it's found at

/usr/local/lib/ghc-7.6.3/settings

Yours is probably somewhere similar, although I'm on Linux rather than OS X. In the file, change

("C compiler command", "/usr/bin/gcc")

to point to an actual copy of gcc rather than Clang and try installing again.

In the long run, this feels like a bug with the package and probably needs to be addressed, although I don't really know enough about the issue or constraints package authors have to be sure.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top