Cabal沙盒正在使用全局依赖项。无法解析。

4
我正在尝试在现有应用程序中添加timerep,但无法解决依赖关系。看起来它正在使用全局安装的版本time == 1.4.2,而对于我的应用程序,>= 1.5会更理想。
如何让cabal使用time 1.5?我已经查看了unix、tls、process、timerep等内容,如果它只使用time >= 1.5,它们似乎都可以正常工作。
这里是错误信息:
serials> cabal install --only-dependencies
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: serials-0.1.0.2 (user goal)
trying: mandrill-0.2.2.0 (dependency of serials-0.1.0.2)
trying: http-client-tls-0.2.2 (dependency of mandrill-0.2.2.0)
trying: tls-1.2.17 (dependency of http-client-tls-0.2.2)
trying: x509-validation-1.5.2 (dependency of tls-1.2.17)
trying: process-1.2.0.0/installed-487... (dependency of x509-validation-1.5.2)
next goal: unix (dependency of process-1.2.0.0/installed-487...)
rejecting: unix-2.7.0.1/installed-299... (conflict: unix =>
time==1.4.2/installed-bf9..., serials => time>=1.5)
rejecting: unix-2.7.1.0, 2.7.0.1, 2.7.0.0, 2.6.0.1, 2.6.0.0, 2.5.1.1, 2.5.1.0,
2.5.0.0, 2.4.2.0, 2.4.1.0, 2.4.0.2, 2.4.0.1, 2.4.0.0, 2.3.2.0, 2.3.1.0,
2.3.0.0, 2.2.0.0, 2.0 (conflict: process => unix==2.7.0.1/installed-299...)
Dependency tree exhaustively searched.

Cabal文件

-- Initial serials.cabal generated by cabal init.  For further
-- documentation, see http://haskell.org/cabal/users-guide/

name:                serials
version:             0.1.0.2
synopsis:            serials
description:         serials
license:             MIT
license-file:        LICENSE
author:              Sean Hess
maintainer:          Sean Hess
-- copyright:
category:            Web Scraper
build-type:          Simple
extra-source-files:  README.md
cabal-version:       >=1.10
Source-repository head
  type:       git
  location:   git@github.com:seanhess/serials.git

executable serials
  main-is:             Main.hs
  hs-source-dirs:      server
  ghc-options:         -fcontext-stack=36
  -- other-modules:
  -- other-extensions:
  default-language:     Haskell2010
  build-depends:
    base >=4.7 && <5,
    tagsoup,
    text,
    scalpel,
    containers,
    network-uri,
    monad-loops,
    wreq,
    lens,
    bytestring,
    parsec,
    utf8-string,
    tagsoup,
    xml,
    feed,
    regex-pcre,
    aeson,
    network,
    wai,
    wai-extra,
    wai-cors,
    wai-middleware-static,
    warp,
    servant-server >= 0.4,
    rethinkdb >= 1.16,
    transformers,
    either,
    unordered-containers,
    mtl,
    http-types,
    safe,
    hashable,
    resource-pool,
    time >= 1.5,
    pooled-io,
    shelly,
    string-conversions,
    bcrypt,
    random,
    jwt,
    cookie,
    entropy,
    mandrill == 0.2.2.0,
    email-validate,
    blaze-markup,
    blaze-html,
    iso8601-time,
    scotty == 0.10.0,
    timerep >= 2.0.0
1个回答

5

cabal-install很难生成一个安装问题的相互不兼容性的完整描述。它决定先打印第一条失败路径。

但是,它会打印Dependency tree exhaustively searched.,这表明实际上没有解决方案。

一个常用的方法是查看cabal-install所做的选择,找到一个看起来次优的选项,然后添加一个明确的约束条件来更改它。这可能会产生更好的错误消息。

让我们尝试一下[请注意,我不确定我的包数据库是否与您的完全相同,因此在您的系统上可能会产生不同的结果]。

您拥有的内容为(哈希值除外):

$ cabal install --only-dependencies
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: serials-0.1.0.2 (user goal)
trying: mandrill-0.2.2.0 (dependency of serials-0.1.0.2)
trying: http-client-tls-0.2.2 (dependency of mandrill-0.2.2.0)
trying: tls-1.2.17 (dependency of http-client-tls-0.2.2)
trying: x509-validation-1.5.2 (dependency of tls-1.2.17)
trying: process-1.2.0.0/installed-06c... (dependency of x509-validation-1.5.2)
next goal: unix (dependency of process-1.2.0.0/installed-06c...)
rejecting: unix-2.7.0.1/installed-f86... (conflict: unix =>
time==1.4.2/installed-9b3..., serials => time>=1.5)
rejecting: unix-2.7.1.0, 2.7.0.1, 2.7.0.0, 2.6.0.1, 2.6.0.0, 2.5.1.1, 2.5.1.0,
2.5.0.0, 2.4.2.0, 2.4.1.0, 2.4.0.2, 2.4.0.1, 2.4.0.0, 2.3.2.0, 2.3.1.0,
2.3.0.0, 2.2.0.0, 2.0 (conflict: process => unix==2.7.0.1/installed-f86...)
Dependency tree exhaustively searched.

经过查看,错误出现在unix上,它是process的一个依赖项。因此,选择安装的process实例会导致问题。那么如果我们禁止选择该实例的process会怎样呢?

$ cabal install --only-dependencies --constraint="process source"
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: serials-0.1.0.2 (user goal)
next goal: time (dependency of serials-0.1.0.2)
rejecting: time-1.4.2/installed-9b3... (conflict: serials => time>=1.5)
trying: time-1.5.0.1
next goal: rethinkdb (dependency of serials-0.1.0.2)
rejecting: rethinkdb-1.16.0.0 (conflict: time==1.5.0.1, rethinkdb =>
time==1.4.*)
rejecting: rethinkdb-1.15.2.1, 1.15.2.0, 1.15.1.0, 1.15.0.0, 1.8.0.5, 1.8.0.4,
1.8.0.3, 1.8.0.2, 1.8.0.1, 1.8.0.0, 0.1.0.0 (conflict: serials =>
rethinkdb>=1.16)
Dependency tree exhaustively searched.

啊哈!所以,rethinkdbserials的直接依赖项,并且明确依赖于time == 1.4.*。这与serialstime >= 1.5的依赖项直接冲突。
这不容易解决。您需要使rethinkdb适用于更新的time库,或使serials适用于旧版。
现在我们进入了推测的领域:可能,但不保证,rethinkdb实际上可以使用新版本的time。我们可以尝试指示cabal-install考虑此类安装计划:
$ cabal install --only-dependencies --allow-newer=time

实际上,这在我的机器上产生了一个安装计划。我尚未尝试构建它,也不知道它是否有效。但是尝试一下可能是值得的。


这是一个非常棒的答案。谢谢你带我走过你是如何解决它的。在约束中,“source”是什么意思? - Sean Clark Hess
1
这意味着已安装的实例被排除在外。 - kosmikus

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接