Search code examples
haskellcabalc2hs

c2hs installation error with Mac OS X 10.7.5


I'm trying to install c2hs with cabal install c2hs. I created ~/.cabal/bin to install the binary beforehand.

With the command cabal install c2hs to get the errors.

src/Control/StateTrans.hs:77:1: Warning:
    Module `Prelude' does not export `catch'
[ 3 of 26] Compiling Data.Errors      ( src/Data/Errors.hs, dist/build/c2hs/c2hs-tmp/Data/Errors.o )
[ 4 of 26] Compiling Data.Attributes  ( src/Data/Attributes.hs, dist/build/c2hs/c2hs-tmp/Data/Attributes.o )
[ 5 of 26] Compiling Text.Lexers      ( src/Text/Lexers.hs, dist/build/c2hs/c2hs-tmp/Text/Lexers.o )
[ 6 of 26] Compiling Control.StateBase ( src/Control/StateBase.hs, dist/build/c2hs/c2hs-tmp/Control/StateBase.o )
[ 7 of 26] Compiling Data.NameSpaces  ( src/Data/NameSpaces.hs, dist/build/c2hs/c2hs-tmp/Data/NameSpaces.o )
[ 8 of 26] Compiling C2HS.C.Attrs     ( src/C2HS/C/Attrs.hs, dist/build/c2hs/c2hs-tmp/C2HS/C/Attrs.o )
[ 9 of 26] Compiling C2HS.C.Builtin   ( src/C2HS/C/Builtin.hs, dist/build/c2hs/c2hs-tmp/C2HS/C/Builtin.o )
[10 of 26] Compiling Paths_c2hs       ( dist/build/autogen/Paths_c2hs.hs, dist/build/c2hs/c2hs-tmp/Paths_c2hs.o )

dist/build/autogen/Paths_c2hs.hs:21:13: Not in scope: `catch'

dist/build/autogen/Paths_c2hs.hs:22:13: Not in scope: `catch'

dist/build/autogen/Paths_c2hs.hs:23:14: Not in scope: `catch'

dist/build/autogen/Paths_c2hs.hs:24:17: Not in scope: `catch'
cabal: Error: some packages failed to install:
c2hs-0.16.5 failed during the building phase. The exception was:
ExitFailure 1

What is wrong with the installation? The ghc version is 7.6.3.


Solution

  • The issue was that I installed two different versions of ghc on my mac: one from brew install ghc and the other from haskell platform.

    I had to install the newest version of haskell platform, but before doing that I also needed to uninstall old version uninstall-hs only VERSION and brew unistall ghc.

    After reinstalling the newest haskell platform, the compilation works fine.

    Other method can be using brew brew install haskell-platform.