2012-12-30 134 views
4

我想安裝HTF。不過我cabal install HTF後,我得到這個:用Cabal安裝HTF時出現故障

Resolving dependencies... 
Configuring HTF-0.10.0.7... 
Warning: This package indirectly depends on multiple versions of the same 
package. This is highly likely to cause a compile failure. 
package regex-base-0.93.2 requires mtl-2.0.1.0 
package aeson-0.6.0.2 requires mtl-2.1.2 
package HTF-0.10.0.7 requires mtl-2.1.2 
package mtl-2.0.1.0 requires transformers-0.2.2.0 
package transformers-base-0.4.1 requires transformers-0.3.0.0 
package mtl-2.1.2 requires transformers-0.3.0.0 
package monad-control-0.3.1.4 requires transformers-0.3.0.0 
Building HTF-0.10.0.7... 
Preprocessing library HTF-0.10.0.7... 
ghc: could not execute: cpphs 
cabal: Error: some packages failed to install: 
HTF-0.10.0.7 failed during the building phase. The exception was: 
ExitFailure 1 

我試圖安裝其他版本,但已經得到了不同的問題。例如, 與cabal install 'HTF <= 0.1'我得到如下:

Resolving dependencies... 
Downloading QuickCheck-1.2.0.1... 
Configuring QuickCheck-1.2.0.1... 
Building QuickCheck-1.2.0.1... 
Preprocessing library QuickCheck-1.2.0.1... 
[1 of 8] Compiling Test.QuickCheck (Test/QuickCheck.hs, dist/build/Test/QuickCheck.o) 
[2 of 8] Compiling Test.QuickCheck.Batch (Test/QuickCheck/Batch.hs, dist/build/Test/QuickCheck/Batch.o) 
[3 of 8] Compiling Test.QuickCheck.Utils (Test/QuickCheck/Utils.hs, dist/build/Test/QuickCheck/Utils.o) 
[4 of 8] Compiling Test.QuickCheck.Poly (Test/QuickCheck/Poly.hs, dist/build/Test/QuickCheck/Poly.o) 
[5 of 8] Compiling Debug.QuickCheck.Poly (Debug/QuickCheck/Poly.hs, dist/build/Debug/QuickCheck/Poly.o) 
[6 of 8] Compiling Debug.QuickCheck.Utils (Debug/QuickCheck/Utils.hs, dist/build/Debug/QuickCheck/Utils.o) 
[7 of 8] Compiling Debug.QuickCheck (Debug/QuickCheck.hs, dist/build/Debug/QuickCheck.o) 
[8 of 8] Compiling Debug.QuickCheck.Batch (Debug/QuickCheck/Batch.hs, dist/build/Debug/QuickCheck/Batch.o) 
Registering QuickCheck-1.2.0.1... 
Installing library in /home/xxx/.cabal/lib/QuickCheck-1.2.0.1/ghc-7.4.1 
Registering QuickCheck-1.2.0.1... 
Downloading HTF-0.1... 
Configuring HTF-0.1... 
Building HTF-0.1... 
Preprocessing library HTF-0.1... 
[1 of 8] Compiling Test.Framework.Utils (Test/Framework/Utils.hs, dist/build/Test/Framework/Utils.o) 
[2 of 8] Compiling Test.Framework.Process (Test/Framework/Process.hs, dist/build/Test/Framework/Process.o) 

Test/Framework/Process.hs:45:48: 
    Ambiguous type variable `a0' in the constraints: 
     (Show a0) 
     arising from a use of `show' at Test/Framework/Process.hs:45:48-51 
     (Control.Exception.Exception a0) 
     arising from a use of `Control.Exception.handle' 
     at Test/Framework/Process.hs:45:5-28 
    Probable fix: add a type signature that fixes these type variable(s) 
    In the expression: show e 
    In the first argument of `return', namely 
     `([], show e, error (show e))' 
    In the expression: return ([], show e, error (show e)) 
cabal: Error: some packages failed to install: 
HTF-0.1 failed during the building phase. The exception was: 
ExitFailure 1 

我也得到類似cabal install 'HTF <= 0.9'後的第一個成果。我試過ghc-pkg check,它給了我一個破包的列表。我重新安裝了軟件包,並重復嘗試再次安裝HTF,結果相同。

+2

修復包數據庫的最可靠的方法是刪除包含本地包數據庫的主目錄中的〜/ .ghc/ /'文件夾。這有效地重置了所有本地安裝的軟件包(與全球安裝的軟件包相比,Haskell平臺安裝的軟件包相對而言),但不會混淆任何全局狀態。這有助於'cabal'找到一個從依賴關係本地最小值出發的路徑,這個最小值是你從安裝先前被鎖定在某些依賴關係中的包創建的。 –

回答

5

第一個問題是,你有regex-base建對mtl-2.0.1.0,從而

package regex-base-0.93.2 requires mtl-2.0.1.0 
package aeson-0.6.0.2 requires mtl-2.1.2 

HTF將取決於mtl多個版本。這很少起作用。

解決方案將是$ ghc-pkg unregister regex-base。如果ghc-pkg警告說會破壞其他軟件包,那麼您也必須重建這些軟件包。如果手動執行的太多,可以考慮刪除整個用戶軟件包-db(我希望這些軟件包都是用戶安裝的,如果它們是全局安裝的,則不能刪除整個全局數據庫)並重建所有內容與cabal install world

regex-base被刪除後,什麼都不會取決於mtl-2.0.1.0了,並且依賴關係不應該引起衝突;實際安裝HTF之前,您應該檢查與

cabal install HTF --dry-run 

如果仍然會有衝突,應該檢測它們,你可以通過註銷進一步包解決這些問題。

下一個問題是

ghc: could not execute: cpphs 

這看起來就好像你在你的PATH沒有cpphs。要麼您沒有安裝它,在這種情況下,您需要在安裝HTF之前執行此操作,否則需要將其安裝目錄添加到PATH