【问题标题】:Installing Cabal has missing modules安装 Cabal 缺少模块
【发布时间】:2014-10-09 06:45:39
【问题描述】:

我的 ghc 安装已过期,因此我决定重新安装 ghc 和 cabal 以希望能解决一些问题。我开始遵循here 的步骤。 GHC 现在是 7.8.3 版。

然后我删除了 ~/.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

【问题讨论】:

  • 如果按照建议运行ghc-pkg check 会发生什么?
  • @GaneshSittampalam 用 ghc-pkg 检查输出更新了问题
  • 首先清除 ghc 包。无论如何,在沙盒中工作是最可靠的方式,全局包往往会破坏很多。

标签: haskell cabal


【解决方案1】:

您可以在每个损坏的包上使用ghc-pkg unregister 以正确清理它们,或者可能吹走整个~/.ghc 文件夹并重新开始。您可能需要使用--force 来避免必须尊重包的依赖顺序。

【讨论】:

  • 我认为他也应该在重新开始之前删除他的 .cabal 文件夹
  • 我没有删除我的 .ghc 目录。为了清楚起见,我需要删除 .ghc 和 .cabal,然后重新安装 ghc 和 cabal,还是只删除这些目录并安装 cabal?
  • 删除了 .ghc 和 .cabal 并再次尝试,cabal 已安装并且是最新的。谢谢 Ganesh。
【解决方案2】:

您在删除 ~/.cabal 时是否也删除了 ~/.ghc?如果没有,我建议您尝试一下,因为如果我理解正确,第一个可能包含对第二个中安装的软件包的引用。

【讨论】:

    猜你喜欢
    • 2016-06-04
    • 2012-04-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-04
    相关资源
    最近更新 更多