我似乎无法在我的Mac上安装一些Haskell软件包(10.6.8)。我第一次尝试了Happstack但它失败了,然后我尝试了Snap。
有时当我运行ghci时,我会遇到分段错误。
其他时候它的工作原理如下:
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>
试图获取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
我已经看过几次这个问题,但没有什么能真正为我解决。有什么想法吗?
答案 0 :(得分:42)
您是否尝试过使用homebrew?它为您处理依赖项。我使用的是Mac OS X 10.7.5,但这些说明应该适合您。
使用homebrew,您可以使用brew命令安装haskell-platform。这需要一段时间。 haskell-platform的编译阶段耗时15分钟。
$ brew search haskell
haskell-platform
$ brew install haskell-platform
==> Installing haskell-platform dependency: ghc
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/ghc-7.4.2.lion.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring ghc-7.4.2.lion.bottle.1.tar.gz
==> Caveats
This brew is for GHC only; you might also be interested in haskell-platform.
==> Summary
/usr/local/Cellar/ghc/7.4.2: 5176 files, 767M
==> Installing haskell-platform
==> Downloading http://lambda.haskell.org/platform/download/2012.4.0.0/haskell-platform-2012.4.0.0.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/haskell-platform/2012.4.0.0 --enable-unsupported-ghc-version
==> make install
==> Caveats
Run `cabal update` to initialize the package list.
If you are replacing a previous version of haskell-platform, you may want
to unregister packages belonging to the old version. You can find broken
packages using:
ghc-pkg check --simple-output
You can uninstall them using:
ghc-pkg check --simple-output | xargs -n 1 ghc-pkg unregister --force
==> Summary
/usr/local/Cellar/haskell-platform/2012.4.0.0: 952 files, 208M, built in 15.3 minutes
安装完成后,您应该可以运行:
$ ghc
ghc: no input files
Usage: For basic information, try the `--help' option.
和Haskell解释器一样,ghci:
$ ghci
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> putStrLn "Hello World"
Hello World
Prelude>
Leaving GHCi.
希望这有帮助!
答案 1 :(得分:30)
brew install haskell-platform
不再受支持。你可能想要
错误:没有可用的haskell-platform公式 我们不再打包haskell-platform。考虑安装ghc和cabal-install代替:
brew install ghc cabal-install
答案 2 :(得分:13)
由于Mac上自制的haskell-platform
已弃用,您可以改用brew install ghc cabal-install
。我是在优胜美地上做的,花了大约一分钟......
> $ brew install ghc cabal-install
==> Downloading https://homebrew.bintray.com/bottles/ghc-7.10.1_1.yosemite.bottl
######################################################################## 100.0%
==> Pouring ghc-7.10.1_1.yosemite.bottle.tar.gz
/usr/local/Cellar/ghc/7.10.1_1: 5423 files, 821M
==> Downloading https://homebrew.bintray.com/bottles/cabal-install-1.22.2.0.yose
######################################################################## 100.0%
==> Pouring cabal-install-1.22.2.0.yosemite.bottle.1.tar.gz
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
==> Summary
/usr/local/Cellar/cabal-install/1.22.2.0: 6 files, 19M
答案 3 :(得分:10)
这是一个老问题,但考虑到它在谷歌搜索上很安静。这就是我到达这里的方式。
$ brew update
$ brew install haskell-stack
$ stack --version
$ stack --help # "man stack" gives something completely different
$ stack setup # Install GHC
$ stack ghci
来源:http://seanhess.github.io/2015/08/04/practical-haskell-getting-started.html
编辑:
我觉得很难写'#34; stack ghci"每次我想使用" ghci"。解决这个问题的方法是简单地将这些行添加到〜/ .bash_aliases文件中:
alias sghc='stack ghc'
alias sghci='stack ghci'
alias srunhaskell='stack runhaskell'
然后找到要申请的文件:
$ source ~/.bash_aliases
然后我可以运行ghci和/或haskell运行这些命令,它将使用堆栈版本:
$ sghc [filename]
$ sghci
$ srunhaskell
答案 4 :(得分:8)
更新:2016年2月:虽然其他答案很有帮助,但我没有找到完整的最新答案。
安装很简单:
$ brew install ghc cabal-install
我需要执行安装后的额外步骤:
$ cabal update
接下来是:
$ cabal install ghc-mod
有关详细信息,请参阅here。
或者,不要使用自制软件进行安装,请访问Haskell Platform获取安装程序磁盘映像 - 请注意,Haskell Platform仅与OS X 10.6及更高版本兼容。
虽然,作为一般规则,我总是使用自制程序来管理我的依赖项,但是当谈到Haskell时,我的建议(除非你真的知道你在做什么)就是安装这个二进制文件。这可以避免任何进一步的意外。本地安装的优秀文档位于: file:///Library/Haskell/doc/start.html
不再支持这个问题的流行答案(使用brew来安装haskell-platform)。
答案 5 :(得分:5)
不幸的是,OS X 10.6不支持GHC 7.4; the download page只有10.7的安装程序,正如您所看到的,它们意味着它。我从痛苦的经历中知道你的问题 - 我在你的船上已经有好久了,除了升级Mac OS X之外我从未找到过解决方案(或者,大概是降级GHC,但我真的不想这样做)。我的一位同事确实设法在OS X 10上运行7.4.1 5 ,但是她需要付出很大的努力(她必须使用不同版本的GMP,即5.0.5,并编辑GHC的配置脚本),我从未尝试过自己复制它。
最后,您有四个选项,大致按简单顺序排列:
答案 6 :(得分:2)
2017年末答案。我正在运行macOS Sierra - 10.12.6(16G29)。这在我的MacBook Air上安装时间不到五分钟就成功了:
brew cask install haskell-platform
然后ghc --version
报告:
Glorious Glasgow Haskell编译系统,版本8.2.1