我最近重新安装了我的Haskell环境,因为我认为在将Mac OS X更新为Mavericks之后,我已将其恢复到恢复之外。
现在每次运行cabal install cabal-install
时,都会出现以下错误。
Resolving dependencies...
Configuring cabal-install-1.18.0.3...
/var/folders/4l/qbdvy5xj4q53skv0zn0lhw940000gp/T/8247.c:1:12:
warning: control reaches end of non-void function [-Wreturn-type]
int foo() {}
^
1 warning generated.
Building cabal-install-1.18.0.3...
Preprocessing executable 'cabal' for cabal-install-1.18.0.3...
Main.hs:118:8:
Could not find module `Distribution.Version'
There are files missing in the `Cabal-1.18.1.3' package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.
Failed to install cabal-install-1.18.0.3
cabal: Error: some packages failed to install:
cabal-install-1.18.0.3 failed during the building phase. The exception was:
ExitFailure 1
Abes-MacBook-Pro:artifact abe$ cabal install cabal-install
Resolving dependencies...
Configuring cabal-install-1.18.0.3...
/var/folders/4l/qbdvy5xj4q53skv0zn0lhw940000gp/T/8335.c:1:12:
warning: control reaches end of non-void function [-Wreturn-type]
int foo() {}
^
1 warning generated.
Building cabal-install-1.18.0.3...
Preprocessing executable 'cabal' for cabal-install-1.18.0.3...
Main.hs:118:8:
Could not find module `Distribution.Version'
There are files missing in the `Cabal-1.18.1.3' package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.
Failed to install cabal-install-1.18.0.3
cabal: Error: some packages failed to install:
cabal-install-1.18.0.3 failed during the building phase. The exception was:
ExitFailure 1
在谷歌搜索后,我发现了这个:http://www.haskell.org/platform/ghc-clang-wrapper
我跑来为Haskell包装clang,但是仍然会出现上述错误。
正在运行ghc-pkg check
There are problems in package Cabal-1.18.1.3:
Warning: library-dirs: /Users/abe/Library/Haskell/ghc-7.6.3/lib/Cabal-1.18.1.3/lib doesn't exist or isn't a directory
Warning: haddock-interfaces: /Users/abe/Library/Haskell/ghc-7.6.3/lib/Cabal-1.18.1.3/doc/html/Cabal.haddock doesn't exist or isn't a file
Warning: haddock-html: /Users/abe/Library/Haskell/ghc-7.6.3/lib/Cabal-1.18.1.3/doc/html doesn't exist or isn't a directory
import-dirs: /Users/abe/Library/Haskell/ghc-7.6.3/lib/Cabal-1.18.1.3/lib doesn't exist or isn't a directory
file Distribution/Compat/Environment.hi is missing
file Distribution/Compat/Exception.hi is missing
file Distribution/Compat/ReadP.hi is missing
file Distribution/Compiler.hi is missing
file Distribution/InstalledPackageInfo.hi is missing
file Distribution/License.hi is missing
file Distribution/Make.hi is missing
file Distribution/ModuleName.hi is missing
file Distribution/Package.hi is missing
file Distribution/PackageDescription.hi is missing
file Distribution/PackageDescription/Check.hi is missing
file Distribution/PackageDescription/Configuration.hi is missing
file Distribution/PackageDescription/Parse.hi is missing
file Distribution/PackageDescription/PrettyPrint.hi is missing
file Distribution/PackageDescription/Utils.hi is missing
file Distribution/ParseUtils.hi is missing
file Distribution/ReadE.hi is missing
file Distribution/Simple.hi is missing
file Distribution/Simple/Bench.hi is missing
file Distribution/Simple/Build.hi is missing
file Distribution/Simple/Build/Macros.hi is missing
file Distribution/Simple/Build/PathsModule.hi is missing
file Distribution/Simple/BuildPaths.hi is missing
file Distribution/Simple/BuildTarget.hi is missing
file Distribution/Simple/CCompiler.hi is missing
file Distribution/Simple/Command.hi is missing
file Distribution/Simple/Compiler.hi is missing
file Distribution/Simple/Configure.hi is missing
file Distribution/Simple/GHC.hi is missing
file Distribution/Simple/Haddock.hi is missing
file Distribution/Simple/Hpc.hi is missing
file Distribution/Simple/Hugs.hi is missing
file Distribution/Simple/Install.hi is missing
file Distribution/Simple/InstallDirs.hi is missing
file Distribution/Simple/JHC.hi is missing
file Distribution/Simple/LHC.hi is missing
file Distribution/Simple/LocalBuildInfo.hi is missing
file Distribution/Simple/NHC.hi is missing
file Distribution/Simple/PackageIndex.hi is missing
file Distribution/Simple/PreProcess.hi is missing
file Distribution/Simple/PreProcess/Unlit.hi is missing
file Distribution/Simple/Program.hi is missing
file Distribution/Simple/Program/Ar.hi is missing
file Distribution/Simple/Program/Builtin.hi is missing
file Distribution/Simple/Program/Db.hi is missing
file Distribution/Simple/Program/Find.hi is missing
file Distribution/Simple/Program/GHC.hi is missing
file Distribution/Simple/Program/HcPkg.hi is missing
file Distribution/Simple/Program/Hpc.hi is missing
file Distribution/Simple/Program/Ld.hi is missing
file Distribution/Simple/Program/Run.hi is missing
file Distribution/Simple/Program/Script.hi is missing
file Distribution/Simple/Program/Types.hi is missing
file Distribution/Simple/Register.hi is missing
file Distribution/Simple/Setup.hi is missing
file Distribution/Simple/SrcDist.hi is missing
file Distribution/Simple/Test.hi is missing
file Distribution/Simple/UHC.hi is missing
file Distribution/Simple/UserHooks.hi is missing
file Distribution/Simple/Utils.hi is missing
file Distribution/System.hi is missing
file Distribution/TestSuite.hi is missing
file Distribution/Text.hi is missing
file Distribution/Verbosity.hi is missing
file Distribution/Version.hi is missing
file Language/Haskell/Extension.hi is missing
file Distribution/Compat/CopyFile.hi is missing
file Distribution/Compat/TempFile.hi is missing
file Distribution/GetOpt.hi is missing
file Distribution/Simple/GHC/IPI641.hi is missing
file Distribution/Simple/GHC/IPI642.hi is missing
file Paths_Cabal.hi is missing
cannot find libHSCabal-1.18.1.3.a on library path
Warning: haddock-interfaces: /Library/Haskell/ghc-7.6.3/lib/haskell-platform-2013.2.0.0/doc/html/haskell-platform.haddock doesn't exist or isn't a file
Warning: haddock-html: /Library/Haskell/ghc-7.6.3/lib/haskell-platform-2013.2.0.0/doc/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.
Cabal-1.18.1.3
为什么我的Haskell环境如此惊人?我该如何解决?
答案 0 :(得分:6)
一种方法是删除本地ghc
包缓存:
$ cd ~/.ghc/ && rm -rf */package.conf.d
$ ghc-pkg --user recache
执行此操作后,再次尝试cabal
命令。
$ cabal install package-name
那应该有效。如果没有,请尝试删除cabal
个包,然后重复上述步骤:
$ rm -rf ~/.cabal
如果您仍然遇到问题,系统ghc包缓存可能会引用丢失的包。运行此命令:
$ ghc-pkg --user recache
$ sudo ghc-pkg recache
$ ghc-pkg -v check
最后一个命令应该打印系统缓存。在我的GNU / Linux系统上,它打印出来:
using cache: /home/sudoman/.ghc/x86_64-linux-7.6.3/package.conf.d/package.cache
using cache: /var/lib/ghc/package.conf.d/package.cache
此时,根据经验,我没有为您提供解决方案,但您可能需要考虑删除上面的ghc系统包缓存,然后进行重新缓存;或重新安装ghc / haskell-platform。
答案 1 :(得分:2)
问题源于cabal可以跟踪同一个包的多个版本。
运行:
cabal install --reinstall Cabal-1.18.1.3
修复了问题