2017-09-02 154 views
1

我對Haskell編程非常陌生,在使用Cabal創建我的第一個正確項目的過程中,我遇到了一個錯誤。Cabal安裝鏈接錯誤

我在構建項目時遵循this教程。然而,當我到了一步,我不得不進入cabal install -j我得到了以下錯誤:

cabal: Entering directory '.' 
Configuring CabalTest-0.1.0.0... 
Building CabalTest-0.1.0.0... 
Preprocessing executable 'CabalTest' for CabalTest-0.1.0.0... 
Linking dist/dist-sandbox-fe048ba8/build/CabalTest/CabalTest ... 
/usr/bin/ld: cannot find -lHSbase-4.9.1.0 
/usr/bin/ld: cannot find -lHSinteger-gmp-1.0.0.1 
/usr/bin/ld: cannot find -lHSghc-prim-0.5.0.0 
/usr/bin/ld: cannot find -lHSrts 
collect2: error: ld returned 1 exit status 
`gcc' failed in phase `Linker'. (Exit code: 1) 
cabal: Leaving directory '.' 

我試圖運行cabal install base integer-gmp ghc-prim rts --reinstall,到它回答的是它無法找到RTS。當我修改的命令,禁止RTS它,而不是輸出這樣的:

cabal: Could not resolve dependencies: 
next goal: base (user goal) 
rejecting: base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0, 
base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0, 
base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0, 
base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1, 
base-4.2.0.0, base-4.1.0.0, base-4.0.0.0 (only already installed instances can 
be used) 
rejecting: base-3.0.3.2 (conflict: base => base>=4.0 && <4.3) 
rejecting: base-3.0.3.1 (conflict: base => base>=4.0 && <4.2) 
Dependency tree exhaustively searched. 

Note: when using a sandbox, all packages are required to have consistent 
dependencies. Try reinstalling/unregistering the offending packages or 
recreating the sandbox. 

運行cabal update沒有幫助和改變〜/ .cabal/config文件包括user-install: False沒有做任何事情無論是。

回答

2

我解決了這個問題。事實證明,問題是由於我通過pacman獲得的GHC包(我正在使用arch linux)。這裏的問題是,每當GHC嘗試鏈接到任何庫時,它都是靜態的。但是,GHC的pacman軟件包不包含任何所需的靜態庫。爲了解決這個問題,我不得不安裝一個名爲ghc-static的包含所有靜態庫的單獨包。