gar*_*560 5 haskell cabal cabal-install
我正在尝试在Windows 10上安装一个名为clanki的程序.在它的安装文档中,它说使用'cabal install clanki'.我下载了cabal,然后是ghc.现在我遇到了包的版本问题base.
$ cabal install clanki
Resolving dependencies...
cabal.exe: Could not resolve dependencies:
trying: clanki-1.2.7 (user goal)
next goal: base (dependency of clanki-1.2.7)
rejecting: base-4.9.0.0/installed-4.9... (conflict: clanki => base<=4.9.0)
rejecting: base-4.9.0.0, base-4.8.2.0, base-4.8.1.0, base-4.8.0.0,
base-4.7.0.2, base-4.7.0.1, base-4.7.0.0, base-4.6.0.1, base-4.6.0.0,
base-4.5.1.0, base-4.5.0.0, base-4.4.1.0, base-4.4.0.0, base-4.3.1.0,
base-4.3.0.0, base-4.2.0.2, base-4.2.0.1, base-4.2.0.0, base-4.1.0.0,
base-4.0.0.0, base-3.0.3.2, base-3.0.3.1 (constraint from non-upgradeable
package requires installed instance)
Dependency tree exhaustively searched.
Run Code Online (Sandbox Code Playgroud)
所以clanki要求基数大于4.9(堆栈比cabal更清楚),然后我想将基数降级到4.8.2.0.当我尝试时ghc-pkg unregister base,它不允许我.甚至没有--force:
$ ghc-pkg unregister base --force
unregistering would break the following packages: xhtml-3000.2.1 Win32-2.3.1.1 transformers-0.5.2.0 time-1.6.0.1 template-haskell-2.11.0.0 process-1.4.2.0 pretty-1.1.3.3 hpc-0.6.0.3 hoopl-3.10.2.1 haskeline-0.7.2.3 ghci-8.0.1 ghc-boot-th-8.0.1 ghc-boot-8.0.1 ghc-8.0.1 filepath-1.4.1.0 directory-1.2.6.2 deepseq-1.4.2.0 containers-0.5.7.1 Cabal-1.24.0.0 bytestring-0.10.8.1 binary-0.8.3.0 array-0.5.1.1 (ignoring)
Run Code Online (Sandbox Code Playgroud)
正如我所提到的,我也试过堆栈,但最后它也归结为错误版本的base.我怎样才能降级这个套餐?
根据@ leftroundabout的回答,base这个包中的上限是假的.在这种情况下,或者只是在您感觉粗体的情况下,您可以使用cabal适当的选项指示忽略依赖关系的上限:
cabal install clanki --allow-newer=base
Run Code Online (Sandbox Code Playgroud)
你不能.base固定在GHC安装上; 获得不同版本的唯一方法是安装较旧的编译器,即GHC-7.10.stack会自动为你做,但我不确定这是否是最好的解决方案.
可能足够,包会实际上GHC 8.0工作; 事实上,约束base <= 4.9.0表明它应该.这种约束没有多大意义,因为它只允许先预先设置子规划; 它可能应该是真的base < 4.10.
所以最好的方法是从github下载源代码base,实际上没有上限,并从本地文件夹中安装它cabal install.如果可行,请通知作者放松对Hackage的约束.
如果它不能在GHC-8.0中编译,那么最好的方法是通过编辑源代码然后提交拉取请求来使其工作.
或者,我会使用堆栈来安装具有较旧GHC的软件包.为此,获取带有base < 4.9约束的源代码(您需要在github代码中插入),然后运行stack setup,stack init和stack install.