使用 cabal 安装库时无法解析依赖项

时间:2021-07-28 10:37:46

标签: haskell cabal

我尝试在 Window 10 上使用 cabal 安装库的一切努力都导致了同样的错误:

cabal install gtk
cabal.exe: Could not resolve dependencies:
[__0] trying: parconc-examples-0.4.8 (user goal)
[__1] next goal: base (dependency of parconc-examples)
[__1] rejecting: base-4.15.0.0/installed-4.15.0.0 (conflict: parconc-examples
=> base>=4.5 && <4.14)
[__1] skipping: base-4.15.0.0, base-4.14.2.0, base-4.14.1.0, base-4.14.0.0
(has the same characteristics that caused the previous version to fail:
excluded by constraint '>=4.5 && <4.14' from 'parconc-examples')
[__1] rejecting: base-4.13.0.0, base-4.12.0.0, base-4.11.1.0, base-4.11.0.0,
base-4.10.1.0, base-4.10.0.0, base-4.9.1.0, 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)
[__1] fail (backjumping, conflict set: base, parconc-examples)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, parconc-examples

它在 Linux 上运行得很好,但我还没有找到如何在 Windows 上解决这个问题。

1 个答案:

答案 0 :(得分:4)

您的 base 库版本是 4.15.0.0base 的特殊之处在于它的版本是 tied to your GHC version,似乎是 GHC 9.0.1。

因此,与其他库不同,cabal 不能在某些软件包的 base 需要时简单地安装先前版本的 build-depends:

parconc-examplesbase 具有以下约束:>=4.5 && <4.14。因此版本 4.15 不被接受(“不可升级包的约束需要安装实例”)。

您可以尝试的一件事是传递额外的选项 --allow-newer=base,例如 cabal install --allow-newer=base gtk。这将放宽限制。

但它不是灵丹妙药:parconc-examples(或 gtk 所需的其他包)实际上可能无法使用 base == 4.15 构建,因为它可能使用了 {{1} 的某些方面}} 以非向后兼容的方式发生了变化。毕竟,防止此类构建失败是边界的目的。