I've recently reinstalled my Haskell environment as I thought I had hosed it beyond recovery after updating my Mac OS X to Mavericks.
Now every time I run cabal install cabal-install
, I get the following error.
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
After googling around, I've found this: http://www.haskell.org/platform/ghc-clang-wrapper
Which I ran to wrap clang for Haskell, however the above error still occurs.
running 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
Why is my Haskell environment so phenomenally broken? And how can I fix it?
One approach is to remove your local
ghc
package cache:After you do this, try the
cabal
command again.That should work. If it doesn't, try removing your
cabal
packages, then repeating the above steps:If you're still having trouble, the missing package may be referred to by the system ghc package cache. Run this command:
The last command should print the system cache. On my GNU/Linux sytem, it prints this:
At that point, I don't have a solution for you based on experience, but you may want to consider removing the ghc system package cache like above, then doing a recache; or re-installing ghc/haskell-platform.
the problem stems from the fact that cabal can track multiple versions of the same package.
Running:
fixes the problem