ghc armv7 binary + cabal? illegal instruction

I'm trying to get up and running on the raspberry pi 2 with the recently released ghc binaries for armv7, available here:

https://www.haskell.org/ghc/download_ghc_7_10_2#linux_armv7

This says it was built with debian jesse, so I've installed debian jesse on my pi2. I've installed ghc successfully - at least ghci works. But there's no cabal, and apparently ghc 7.10.2 requires cabal 1.22+. The debian version of cabal is something like 1.16 (and also would install ghc 7.6.x). So I'm trying to install cabal-install from source with its bootstrap.sh script. That downloads the mtl package and builds a 'Setup' executble, then tries to execute it. But the Setup exe fails with 'illegal instruction'.

According to the download page, the 'gold' linker is required. I added that by doing

ln -s which gold ~/bin/ld

and setting my path to include ~/bin. Same result unfortunately.

Next up I tried reinstalling the ghc binaries with gold (I think). So as root:

> ln -s `which gold` /usr/local/bin/ld
> cd ghc-7.10.2
> make install

Once again ghc was successfully installed, but the result for building cabal-install is the same:

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.

Any ideas?

I'm wondering if the symlinks is the correct way to enable gold for this? Maybe I need to add that as a ghc option in each cabal project, or there's some other way to use gold? Or maybe that's not the issue at all?


Ok finally got this straightened out. According to the ghc download page you should use llvm 3.5 which comes with debian jessie. But the default llvm version is 3.5-10 and that doesn't work. What is needed is 3.5.2-2.

I downloaded the debs for 3.5.2-2 and installed but it turned into dependency hell pretty quick, needing to install 5-6 libs that llvm 3.5.2-2 requires. I switched to debian testing and it was easier to get llvm installed. It might be easier still if you're on debian experimental.

the ghc 7.10.2 package I used: https://packages.debian.org/experimental/armhf/ghc/download

the bug where I was using it with the default llvm 3.5 on debian jessie: https://ghc.haskell.org/trac/ghc/ticket/10863

链接地址: http://www.djcxy.com/p/28390.html

上一篇: 为什么Unix块的大小随着更大的内存大小而增加?

下一篇: ghc armv7 binary + cabal? 非法指令