使用 cabal 安装库时无法解决依赖关系

Hải*_*ình 7 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
Run Code Online (Sandbox Code Playgroud)

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

dan*_*iaz 10

您的库版本base4.15.0.0. base它的特殊之处在于它的版本与您的 GHC 版本相关,这似乎是 GHC 9.0.1。

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

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

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

但它不是万能药:(parconc-examples或 所需的其他包gtk)实际上可能无法使用 进行构建base == 4.15,因为它可能使用base == 4.14以非向后兼容的方式更改的某些方面。毕竟,防止此类构建失败是边界的目的。