问题描述
我刚刚做了一次cabal更新并试图从hackage安装'镜头'。这给了我以下错误 -
I just did a cabal update and tried to install 'lens' from hackage. That gave me the following error -
$ cabal install -j lens Resolving dependencies... Configuring dlist-0.7.0.1... ... <snip> Configuring mtl-2.0.1.0... Building mtl-2.0.1.0... Failed to install mtl-2.0.1.0 Last 10 lines of the build log ( /home/aj/.cabal/logs/mtl-2.0.1.0.log ): Building mtl-2.0.1.0... Preprocessing library mtl-2.0.1.0... [ 1 of 21] Compiling Control.Monad.Writer.Class ( Control/Monad/Writer/Class.hs, dist/build/Control/Monad/Writer/Class.o ) [ 2 of 21] Compiling Control.Monad.State.Class ( Control/Monad/State/Class.hs, dist/build/Control/Monad/State/Class.o ) [ 3 of 21] Compiling Control.Monad.Reader.Class ( Control/Monad/Reader/Class.hs, dist/build/Control/Monad/Reader/Class.o ) [ 4 of 21] Compiling Control.Monad.RWS.Class ( Control/Monad/RWS/Class.hs, dist/build/Control/Monad/RWS/Class.o ) [ 5 of 21] Compiling Control.Monad.Identity ( Control/Monad/Identity.hs, dist/build/Control/Monad/Identity.o ) [ 6 of 21] Compiling Control.Monad.Error.Class ( Control/Monad/Error/Class.hs, dist/build/Control/Monad/Error/Class.o ) Control/Monad/Error/Class.hs:93:18: Not in scope: `catch' ... <snip> cabal: Error: some packages failed to install: aeson-0.7.0.3 depends on mtl-2.0.1.0 which failed to install. exceptions-0.6 depends on mtl-2.0.1.0 which failed to install. free-4.7.1 depends on mtl-2.0.1.0 which failed to install. lens-4.1.2 depends on mtl-2.0.1.0 which failed to install. mtl-2.0.1.0 failed during the building phase. The exception was: ExitFailure 1
所以看起来像mtl-2.0.1.0已经坏了。然而,更多的依赖关系追踪显示镜头包装定义中没有任何内容实际上取决于该版本的mtl。事实上,我试过的下一件事是 -
So looks like mtl-2.0.1.0 is broken. However some more dependency tracking reveals that nothing in the lens package definition actually depends on that version of mtl. Infact, the next thing I tried was -
$ cabal install -j aeson $ cabal install -j free $ cabal install -j lens
成功没有问题。
那么为什么cabal会在安装 lens 时尝试安装 mtl-2.0.1.0 直?我尝试删除我的.ghc和.cabal目录,并重复这些步骤,获得相同的结果。我使用的cabal版本是1.16 -
So why would cabal try to install mtl-2.0.1.0 when installing lens directly? I've tried removing my .ghc and .cabal directories and repeating the steps, with the same results. The cabal version I'm using is 1.16 -
$ cabal -V cabal-install version 1.16.0.2 using version 1.16.0 of the Cabal library
推荐答案
我正在使用的解决方法是首先安装变形金刚 - 与变形金刚3标志
The workaround that I am using is to first install transformers-compat with the transformers 3 flag
$ cabal install -ftransformer3 transformers-compat
然后用变形金刚0.3.0.0约束安装镜头
and then install lens with the transformers 0.3.0.0 constraint
$ cabal install --constraint="transformers==0.3.0.0" lens
这篇关于“镜头”依赖关系解决方案失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!