2014-10-09 275 views
7

我的ghc安裝已過期,因此我決定重新安裝ghc和cabal以希望解決一些問題。我開始按照步驟here。 GHC現在是7.8.3版本。安裝Cabal缺少模塊

然後我刪除〜/ .cabal,並試圖使用步驟安裝,但它失敗。所以我再次取出.cabal並試圖步驟here但是當我運行sh bootstrap.sh它運行到缺少模塊:

Using local tarball for parsec-3.1.6. 
[1 of 1] Compiling Main    (Setup.hs, Setup.o) 
Linking Setup ... 
Configuring parsec-3.1.6... 
Building parsec-3.1.6... 
Preprocessing library parsec-3.1.6... 

Text/Parsec/Prim.hs:80:8: 
Could not find module ‘Control.Monad.Trans’ 
There are files missing in the ‘mtl-2.2.1’ package, 
try running 'ghc-pkg check'. 
Use -v to see a list of the files searched for. 

Text/Parsec/Prim.hs:81:8: 
Could not find module ‘Control.Monad.Identity’ 
There are files missing in the ‘mtl-2.2.1’ package, 
try running 'ghc-pkg check'. 
Use -v to see a list of the files searched for. 

Text/Parsec/Prim.hs:83:8: 
Could not find module ‘Control.Monad.Reader.Class’ 
There are files missing in the ‘mtl-2.2.1’ package, 
try running 'ghc-pkg check'. 
Use -v to see a list of the files searched for. 

Text/Parsec/Prim.hs:84:8: 
Could not find module ‘Control.Monad.State.Class’ 
There are files missing in the ‘mtl-2.2.1’ package, 
try running 'ghc-pkg check'. 
Use -v to see a list of the files searched for. 

Text/Parsec/Prim.hs:85:8: 
Could not find module ‘Control.Monad.Cont.Class’ 
There are files missing in the ‘mtl-2.2.1’ package, 
try running 'ghc-pkg check'. 
Use -v to see a list of the files searched for. 

Text/Parsec/Prim.hs:86:8: 
Could not find module ‘Control.Monad.Error.Class’ 
There are files missing in the ‘mtl-2.2.1’ package, 
try running 'ghc-pkg check'. 
Use -v to see a list of the files searched for. 

Text/Parsec/Text.hs:19:18: 
Could not find module ‘Data.Text’ 
There are files missing in the ‘text-1.2.0.0’ package, 
try running 'ghc-pkg check'. 
Use -v to see a list of the files searched for. 

Text/Parsec/Text/Lazy.hs:19:18: 
Could not find module ‘Data.Text.Lazy’ 
There are files missing in the ‘text-1.2.0.0’ package, 
try running 'ghc-pkg check'. 
Use -v to see a list of the files searched for. 

Error during cabal-install bootstrap: 
Building the parsec package failed. 

當我運行ghc-pkg check我得到這樣一個整體的東西很多:

cannot find any of ["libHSOpenGLRaw-1.5.0.0.a","libHSOpenGLRaw-1.5.0.0.p_a","libHSOpenGLRaw-1.5.0.0-ghc7.8.3.so","libHSOpenGLRaw-1.5.0.0-ghc7.8.3.dylib","HSOpenGLRaw-1.5.0.0-ghc7.8.3.dll"] on library path 
Warning: haddock-interfaces: /usr/local/share/doc/x86_64-linux-ghc-7.8.3/Cabal-1.21.1.0/html/Cabal.haddock doesn't exist or isn't a file 
Warning: haddock-html: /usr/local/share/doc/x86_64-linux-ghc-7.8.3/Cabal-1.21.1.0/html doesn't exist or isn't a directory 

然後這樣的:

The following packages are broken, either because they have a problem 
listed above, or because they depend on a broken package. 
text-1.1.0.1 
Cabal-1.20.0.2 
zlib-0.5.4.1 
contravariant-1.2 
void-0.6.1 
netwire-5.0.0 
semigroups-0.15.3 
unordered-containers-0.2.5.0 
transformers-compat-0.3.3.4 
exceptions-0.6.1 
MonadRandom-0.3 
mtl-2.2.1 
transformers-0.4.1.0 
cpphs-1.18.5 
polyparse-1.9 
nats-0.2 
hashable-1.2.2.0 
OpenGL-2.9.2.0 
text-1.2.0.0 
tagged-0.7.2 
stb-image-0.2.1 
split-0.2.2 
reflection-1.5.1 
random-1.0.1.1 
primitive-0.5.3.0 
prelude-extras-0.4 
parallel-3.2.0.4 
bitmap-0.0.2 
bindings-DSL-1.0.21 
GLURaw-1.4.0.1 
OpenGLRaw-1.5.0.0 
+0

如果按照建議運行'ghc-pkg check',會發生什麼情況? – 2014-10-09 07:30:11

+0

@GaneshSittampalam用ghc-pkg檢查輸出更新了問題 – 2014-10-09 07:50:01

+0

首先清除ghc包。無論如何,在沙箱中工作是最可靠的方式,全球軟件包往往會打破很多。 – 2014-10-09 07:51:26

回答

7

您可以使用在每個破包ghc-pkg unregister清理出來正常,鄰r可能會吹走整個~/.ghc文件夾並重新開始。您可能需要使用--force以避免必須尊重軟件包的依賴性順序。

+0

我想他也應該刪除他的.cabal文件夾之前開始 – Arnon 2014-10-09 08:30:46

+0

我沒有刪除我的.ghc目錄。爲了清楚起見,我需要刪除.ghc和.cabal,然後重新安裝ghc和cabal,或者刪除這些dirs並安裝cabal? – 2014-10-09 15:23:25

+1

刪除.ghc和.cabal並再次嘗試,cabal已安裝並且是最新的。謝謝Ganesh。 – 2014-10-09 16:46:56

3

當您移除〜/ .cabal時,您是否還移除了〜/ .ghc?如果沒有,我建議你嘗試一下,因爲如果我理解正確,第一個可能包含對第二個安裝的軟件包的引用。