2013-07-20 73 views
10

我想在Raspberry Pi上編譯GHC 7.6.3。 Raspbian附帶的7.4版GHC不支持ghci。 我打算打包v 7.6.3並使其可用。在Raspberry Pi上編譯Haskell

一個looong時間後,我得到淠此錯誤:

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 

任何想法是怎麼回事?

我該如何結束由構建系統產生的缺失中間文件?

+0

看起來像構建工具鏈中某處的錯誤。也許最好在x86系統上嘗試一個交叉編譯器。交叉編譯器是一個薄弱的環節(很可能會暴露一些錯誤),但至少其他工具都經過了很好的測試。看到這裏的指示(從x86 Linux到Raspberry Linux的交叉似乎得到很好的支持):http://ghc.haskell.org/trac/ghc/wiki/CrossCompilation –

+1

Debian提供[GHC 7.6.3 on arm](http ://packages.debian.org/sid/ghc),因此您可能想查看與ARM相關的[Patched](http://patch-tracker.debian.org/package/ghc/7.6.3-3 )由Debian應用。 –

+0

謝謝你們。其實我試圖暫時切換到sid存儲庫來安裝ghc,但這最終導致了一個依賴關係的噩夢(它堅持要升級我的libc)。所以我決定自己編譯它。 –

回答

2

我GHC-7.8.3從上游源編譯樹莓PI。這不是非常快,但它能夠完成任務:

[email protected] ~ $ 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. 有耐心 - 編輯將需要幾天。
+0

謝謝。我設法建立了GHC 7.8。3在我的古代Rev1 Raspberry Pi遵循這些指示。作爲一個額外的步驟,我必須[調整GPU內存分配](http://raspberrypi.stackexchange.com/a/674)降至16G。花了一個星期的時間編譯,我不得不重新編譯幾次,因爲它被殺死了。 – pico