Окружающая среда Haskell после переустановки

Я недавно переустанавливал свою среду на 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

Который я запускал, чтобы обернуть Clang для Haskell, однако вышеупомянутая ошибка все еще происходит

Бег 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 так феноменально нарушена? И как я могу это исправить?

2 ответа

Одним из подходов является удаление вашего местного 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.

Проблема связана с тем, что cabal может отслеживать несколько версий одного и того же пакета.

Бег:

cabal install --reinstall Cabal-1.18.1.3

решает проблему

Другие вопросы по тегам