haskell - 在树莓派上编译 Haskell

标签 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

知道出了什么问题吗?

我怎样才能最终丢失由构建系统生成的中间文件?

最佳答案

我从上游源获得了用 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

关键是要做到以下几点:
  • 有足够的内存。插入外部硬盘并创建一个 4 GB 的交换分区。首发 fdisk选择分区类型为Linux swap,然后执行mkswap /dev/sdXX , 最后做交换 /dev/sdXX , 其中 XX是磁盘 id 字母和分区号。
  • 使用 rpi-update 将内核更新到最新版本以防止挂起。我也有smsc95xx.turbo_mode=N slub_debug=FP/boot/cmdline.txt 中添加到内核命令行的末尾文件。
  • 使用 apt-get install binutils-gold 安装黄金链接器, 因为常规 ld.bfd将无法创建动态库。问题是你不能使用 gold用于链接所有内容,但需要将阶段 1 与 ld.bfd 链接.您需要按照说明 in this script ( original information from here ) 除了您需要使用 ld.bfd用于运行初始 ./configure也打电话。
  • 有耐心——编译需要几天时间。
  • 关于haskell - 在树莓派上编译 Haskell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17765002/

    相关文章:

    haskell - 星号(种类,*)在这个Foldable实例中的作用

    c++ - scons:对象、源代码、可执行文件,都在单独的目录中

    python - 尝试使用树莓派控制8x8 LED矩阵而不使用max7219

    c# - UWP Raspberry Pi 网络服务器问题

    Python urllib 无法打开 localhost

    linux - forkIO/killThread 与 forkProcess 的交互

    haskell - 在我自己的 Queue 类型中包装 Data.Sequence 有什么问题吗?

    Haskell - 请帮我简化这两个函数

    struct - 无法在golang中包含多个文件

    makefile 缺少分隔符