我正在尝试在树莓派2上运行最近发布的针对 ARMv7 的GHC二进制文件,下载链接如下:https://www.haskell.org/ghc/download_ghc_7_10_2#linux_armv7。据称该文件是基于 Debian Jesse 构建的,所以我已经在我的树莓派2上安装了 Debian Jessie。我已经成功地安装了 GHC(至少 ghci 可以运行),但没有 cabal,而 GHC 7.10.2 需要 cabal 1.22+ 。Debian 版本的 cabal 大约是 1.16(同时也会安装 GHC 7.6.x)。因此我试图使用其 bootstrap.sh 脚本从源代码安装 cabal-install。该脚本下载了 mtl 包并构建了一个 'Setup' 可执行文件,然后试图执行它。但是 Setup exe 失败了并提示“非法操作码”。 根据下载页面的说明,“gold”链接器是必需的。我通过以下命令添加:
ln -s which gold ~/bin/ld
并将路径设置为包含~/bin,但结果依然是一样的。接着我尝试使用 gold 重新安装 GHC 二进制文件。这是我以 root 权限进行的。> ln -s `which gold` /usr/local/bin/ld
> cd ghc-7.10.2
> make install
再次成功安装ghc,但构建cabal-install的结果仍然相同:
bburdette@jessie-rpi:~/code/cabal/cabal-install$ ./bootstrap.sh
Using gcc for C compiler. If this is not what you want, set CC.
Using /usr/lib/gcc/arm-linux-gnueabihf/4.9/collect2 instead.
Checking installed packages for ghc-7.10.2...
deepseq is already installed and the version is ok.
binary is already installed and the version is ok.
time is already installed and the version is ok.
Cabal is already installed and the version is ok.
transformers is already installed and the version is ok.
mtl-2.2.1 will be installed from local tarball.
text-1.2.0.3 will be downloaded and installed.
parsec-3.1.7 will be downloaded and installed.
network-2.6.0.2 will be downloaded and installed.
old-locale-1.0.0.7 will be downloaded and installed.
old-time-1.1.0.3 will be downloaded and installed.
HTTP-4000.2.19 will be downloaded and installed.
zlib-0.5.4.2 will be downloaded and installed.
random-1.1 will be downloaded and installed.
stm-2.4.4 will be downloaded and installed.
Using local tarball for mtl-2.2.1.
[1 of 1] Compiling Main ( Setup.hs, Setup.o )
Linking Setup ...
Illegal instruction
Error during cabal-install bootstrap:
Configuring the mtl package failed.
有什么想法吗?
我在思考是否使用符号链接是启用gold的正确方法?也许我需要在每个Cabal项目中将其作为GHC选项添加,或者有其他使用gold的方式?或者也许这根本不是问题?