2016-10-10 104 views
4

使用cabal我只有麻烦,不知道是由于缺乏理解,还是错误的思维模式,但事情一直很艰难。Haskell ghc-mod失败,出现错误

目前我只是想让ghc-mod为我的vim插件工作。它通常适用于一两天,然后开始对失败似乎没有理由一个错误,我收到错误似乎从不时改变,现在我得到这样一个:

$ ghc-mod check Main.hs 
ghc-mod: /Users/chris/.stack/snapshots/x86_64-osx/lts-6.15/7.10.3/pkgdb/package.cache: 
GHC.PackageDb.readPackageDb: inappropriate type (Not a valid Unicode code point!) 

任何想法关于如何解决这类事情?我试着重新安装,但我得到这个(我想我的阴谋包都搞砸了,但不知道如何解决它):

$ cabal install ghc-mod 
Resolving dependencies... 
Downloading haskell-src-exts-1.17.1... 
Configuring haskell-src-exts-1.17.1... 
Failed to install haskell-src-exts-1.17.1 
Build log (/Users/chris/.cabal/logs/haskell-src-exts-1.17.1.log): 
cabal: Entering directory '/var/folders/6l/rdh2g5wn41s8vxchngkt02_c0000gn/T/cabal-tmp-45583/haskell-src-exts-1.17.1' 
Configuring haskell-src-exts-1.17.1... 
cabal: The program 'happy' version >=1.19 is required but it could not be 
found. 
cabal: Leaving directory '/var/folders/6l/rdh2g5wn41s8vxchngkt02_c0000gn/T/cabal-tmp-45583/haskell-src-exts-1.17.1' 
cabal: Error: some packages failed to install: 
ghc-mod-5.6.0.0 depends on haskell-src-exts-1.17.1 which failed to install. 
haskell-src-exts-1.17.1 failed during the configure step. The exception was: 
ExitFailure 1 
hlint-1.9.35 depends on haskell-src-exts-1.17.1 which failed to install. 

编辑: 扭过头去一秒钟,并试图再次,现在我得到这个错误,让我讨厌这个小集团的改变其心中所有的时间:

$ ghc-mod check Main.hs 
[1 of 5] Compiling CabalHelper.Common (CabalHelper/Common.hs, /Users/chris/.ghc-mod/cabal-helper/CabalHelper/Common.o ) 
[2 of 5] Compiling CabalHelper.Licenses (CabalHelper/Licenses.hs, /Users/chris/.ghc-mod/cabal-helper/CabalHelper/Licenses.o ) 

CabalHelper/Licenses.hs:53:18: error: 
Ambiguous occurrence ‘lookupInstalledPackageId’ 
It could refer to either ‘Distribution.Simple.PackageIndex.lookupInstalledPackageId’, 
imported from ‘Distribution.Simple.PackageIndex’ at CabalHelper/Licenses.hs:24:1-39 
or ‘CabalHelper.Licenses.lookupInstalledPackageId’, 
defined at CabalHelper/Licenses.hs:38:1 

CabalHelper/Licenses.hs:74:10: error: 
Ambiguous occurrence ‘lookupInstalledPackageId’ 
It could refer to either ‘Distribution.Simple.PackageIndex.lookupInstalledPackageId’, 
imported from ‘Distribution.Simple.PackageIndex’ at CabalHelper/Licenses.hs:24:1-39 
or ‘CabalHelper.Licenses.lookupInstalledPackageId’, 
defined at CabalHelper/Licenses.hs:38:1 
ghc-mod: readCreateProcess: /Users/chris/.stack/snapshots/x86_64-osx/lts-6.15/7.10.3/libexec/cabal-helper-wrapper "--with-ghc=/usr/local/bin/ghc" "--with-ghc-pkg=/usr/local/bin/ghc-pkg" "--with-cabal=cabal" "/Users/chris/dev/formatter" "/Users/chris/dev/formatter/.stack-work/dist/x86_64-osx/Cabal-1.24.0.0" "package-db-stack" "entrypoints" "source-dirs" "ghc-options" "ghc-src-options" "ghc-pkg-options" "ghc-merged-pkg-options" "ghc-lang-options" "licenses" "flags" "config-flags" "non-default-config-flags" "compiler-version" (exit 1): failed 
+1

我知道这听起来很不好玩,但请允许我建议您使用['stack'](https://docs.haskellstack.org/en/stable/README/)。这使得它更容易通过LTS快照走出阴谋...... – Alec

+0

你能告诉我们更多关于你的工作环境吗?我在上面包含的第一个抄本的路径之一中看到了“.stack”,并且假设你*已经在使用堆栈(除了cabal之外),但也许这是错误的。 –

+0

我为我的大部分东西使用堆栈,它似乎没有工作,我认为它会更容易得到cabal的帮助,也许我不正确, 无论如何,我跑了堆栈安装ghc-mod并将〜/ .local/bin /添加到我的路径中,但我大部分时间仍然遇到错误 –

回答

0

此错误是由有我的本地栈GHC版本和全球GHC-MOD GHC之间的不匹配造成的版本,我更新堆栈项目中的ghc版本到最新版本,一切工作正常。

相关问题