Installing Haskell packages on Mac

2019-03-09 17:33发布

I can't seem to get a few Haskell packages to install on my Mac (10.6.8). I first tried Happstack and it failed and then I tried Snap.

Sometimes when I run ghci I get a segmentation fault.

Other times it works and goes like this:

GHCi, version 7.4.2: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude>

When trying to get Snap:

....
....
....
Loading package vector-0.10.0.1 ... linking ... done.
Loading package zlib-0.5.4.0 ... linking ... done.
Loading package zlib-bindings-0.1.1.3 ... linking ... done.
Loading package zlib-enum-0.2.3 ... linking ... done.
Loading package snap-core-0.9.3.1 ... linking ... done.
Loading package snap-server-0.9.3.3 ... linking ... done.
Loading package directory-tree-0.11.0 ... linking ... done.
cabal: Error: some packages failed to install:
snap-0.11.2 failed during the building phase. The exception was:
ExitFailure 11

I have seen this problem a few times but nothing really solved it for me. Any ideas?

7条回答
\"骚年 ilove
2楼-- · 2019-03-09 18:17

Unfortunately, GHC 7.4 isn't supported on OS X 10.6; the download page only has an installer for 10.7, and as you can see, they mean it. I know your problem from bitter experience—I was in exactly your boat for a good long while, and I never found a solution other than upgrading Mac OS X (or, presumably, downgrading GHC, but I didn't really want to do that). A colleague of mine did manage to get 7.4.1 running on OS X 10.5, but it took nontrivial effort on her part (she had to use a different version of GMP, namely 5.0.5, and edit GHC's configure script), and I never tried to replicate it myself.

In the end, you have four options, in roughly decreasing order of simplicity:

  1. Use an older Haskell Platform. This means downgrading to GHC 7.0.x (not GHC 7.2.x—that was never in the Platform); there's not a good record of which GHC versions were in which package versions, though. Wikipedia implies that 2011.2 was the first version with GHC 7.0.x and that 2012.2 was the first version with GHC 7.4.x, so I'd try 2011.4.0.0 first.
  2. Install GHC 7.2 (which is supported on OS X) on its own, and forgo the Haskell Platform. This can cause headaches, but is possible. Don't forget to install Cabal, cabal-install, all the packages that come with the platform, etc.
  3. Upgrade to OS X 10.7 or 10.8, if you feel like a more global (and pricier) change.
  4. Try to replicate what my colleague did. (Best of luck, but it's definitely possible.)
查看更多
登录 后发表回答