在Raspberry Pi上编译Haskell

时间:2013-07-20 17:51:53

标签: haskell compilation raspberry-pi ghci raspbian

我正在尝试在Raspberry Pi上编译GHC 7.6.3。 Raspbian附带的7.4版GHC不支持 ghci 。 我打算打包v 7.6.3并使其可用。

经过一段时间后,我在Pi上得到了这个错误:

HC [stage 0] utils/hp2ps/dist/build/Key.o
HC [stage 0] utils/hp2ps/dist/build/PsFile.o
HC [stage 0] utils/hp2ps/dist/build/Shade.o
HC [stage 0] utils/hp2ps/dist/build/Utilities.o
"inplace/bin/mkdirhier" utils/hp2ps/dist/build/tmp//.
HC [stage 0] utils/hp2ps/dist/build/tmp/hp2ps
Warning: -rtsopts and -with-rtsopts have no effect with -no-hs-main.
Call hs_init_ghc() from your main() function to set these options.
"cp" -p utils/hp2ps/dist/build/tmp/hp2ps inplace/bin/hp2ps
cp driver/ghc-usage.txt inplace/lib/ghc-usage.txt
cp driver/ghci-usage.txt inplace/lib/ghci-usage.txt
HC [stage 0] utils/genapply/dist/build/GenApply.o
"inplace/bin/mkdirhier" utils/genapply/dist/build/tmp//.
HC [stage 0] utils/genapply/dist/build/tmp/genapply
"cp" -p utils/genapply/dist/build/tmp/genapply inplace/bin/genapply
HC [stage 1] libraries/ghc-prim/dist-install/build/GHC/Types.o
Stack dump:
0.  Program arguments: /usr/bin/llc -O3 -relocation-model=static /tmp/ghc467_0/ghc467_0.bc  -o /tmp/ghc467_0/ghc467_0.lm_s --enable-tbaa=true 
1.  Running pass 'Function Pass Manager' on module '/tmp/ghc467_0/ghc467_0.bc'.
2.  Running pass 'ARM Instruction Selection' on function '@ghczmprim_GHCziTypes_Dzh_info'
/tmp/ghc467_0/ghc467_0.lm_s: openBinaryFile: does not exist (No such file or directory)
make[1]: *** [libraries/ghc-prim/dist-install/build/GHC/Types.o] Error 1
make: *** [all] Error 2

real    308m59.437s
user    292m8.320s
sys     10m18.220s

知道出了什么问题吗?

如何最终找到由构建系统生成的缺少的中间文件?

2 个答案:

答案 0 :(得分:2)

我从上游来源使用Raspberry PI编译了GHC-7.8.3。它不是很快,但它完成了工作:

pi@arlanda ~ $ ghci
GHCi, version 7.8.3: 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> 1+1
2

关键是要做到以下几点:

  1. 有足够的记忆力。插入外部硬盘并创建一个4千兆字节的交换分区。首先在fdisk中选择分区类型为Linux swap,然后执行mkswap /dev/sdXX,最后执行swapon /dev/sdXX,其中XX是磁盘ID字母和分区号。
  2. 使用rpi-update将内核更新到最新版本以防止挂起。我还在smsc95xx.turbo_mode=N slub_debug=FP文件的内核命令行末尾添加了/boot/cmdline.txt
  3. 使用apt-get install binutils-gold安装黄金链接器,因为常规ld.bfd将无法创建动态库。问题是您无法使用gold链接所有内容,但需要将第1阶段与ld.bfd相关联。您需要按照in this scriptoriginal information from here)的说明操作,但需要使用ld.bfd来运行初始./configure电话。
  4. 有耐心 - 汇编需要几天时间。

答案 1 :(得分:0)

您可以随时查看R-Pi的官方haskell页面。希望它能帮助你,而不是帮助我。那里有一些非常有用的链接。

http://www.haskell.org/haskellwiki/Raspberry_Pi