【问题标题】:Cannot install ghc-mod due to “unattainable version of base”无法安装 ghc-mod,因为“基础版本无法实现”
【发布时间】:2019-08-20 20:09:54
【问题描述】:

我正在尝试在 Windows 上安装 ghc-mod 库。使用 stack install ghc-mod 会显示这个冗长的错误消息:

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for ghc-mod-5.8.0.0:
    Cabal-2.4.1.0 from stack configuration does not match >=1.18 && <1.25  (latest matching version is 1.24.2.0)
    base-4.12.0.0 from stack configuration does not match >=4.6.0.1 && <4.10  (latest matching version is 4.9.1.0)
    cabal-helper must match <0.8 && >=0.7.3.0, but the stack configuration has no specified version  (latest matching
                 version is 0.7.3.0)
    djinn-ghc must match <0.1 && >=0.0.2.2, but the stack configuration has no specified version  (latest matching
              version is 0.0.2.3)
    extra-1.6.17 from stack configuration does not match <1.6 && >=1.4  (latest matching version is 1.5.3)
    ghc-8.6.5 from stack configuration does not match >=7.6 && <8.2
    ghc-syb-utils must match <0.3 && >=0.2.3, but the stack configuration has no specified version  (latest matching
                  version is 0.2.3.3)
    haskell-src-exts-1.20.3 from stack configuration does not match <1.20 && >=1.18  (latest matching version is 1.19.1)    hlint-2.1.11 from stack configuration does not match <2.1 && >=2.0.8  (latest matching version is 2.0.15)
    monad-journal-0.8.1 from stack configuration does not match <0.8 && >=0.4  (latest matching version is 0.7.2)
    optparse-applicative-0.14.3.0 from stack configuration does not match >=0.13.0.0 && <0.14  (latest matching version
                                  is 0.13.2.0)
    temporary-1.3 from stack configuration does not match <1.3 && >=1.2.0.3  (latest matching version is 1.2.1.1)
needed since ghc-mod is a build target.

Some different approaches to resolving this:

  * Build requires unattainable version of base. Since base is a part of GHC, you most likely need to use a different
    GHC version with the matching base.

显然,我需要更改 ghc 的版本,但我的版本高于所需的版本,因此更新无济于事。我应该降级吗?如何在不破坏我的其他 ghc 生态系统的情况下做到这一点?

使用 cabal 安装它会得到类似的结果。

【问题讨论】:

标签: windows haskell ghc


【解决方案1】:

抱歉,除非您愿意降级到 GHC 8.0,否则无法执行此操作。请注意,在依赖项列表中它显示为ghc (&gt;=7.6 &amp;&amp; &lt;8.2)。没有 GHC 8.1(奇数用于测试),所以回到 GHC 8.0。

Stackage 提供了一个已知可以一起编译的软件包版本的精选列表,以及一个 GHC 版本。每个长期支持 (LTS) 都是这些版本的特定集合。从 Damián Rafael Lattenero 发布的列表中可以看出,这意味着回到 LTS-9.21

问题是ghc-mod使用GHC作为库和编译器,所以它对版本非常敏感,你必须为ghc-mod和你的软件使用相同版本的编译器正在发展;拥有ghc-mod 的工作版本后,您不能只为自己的程序切换到更高版本的 GHC。

假设您仍想这样做,请获取stack installed。然后编辑您的 ~/.stack/config.yaml 文件(在 Windows 上键入 stack path --stack-root 以查找其存储位置)。将其更改为 resolver: lts-9.21。然后说stack install ghc-mod

【讨论】:

    【解决方案2】:

    stackage 中,您可以找到所有 LTS 版本以及您可以下载的所有可能版本:

    here 是 ghc-mod 所需的所有依赖项的列表:

    你需要检查你没有任何过时的或不匹配的。

    【讨论】:

    • 我在该站点上找不到实际的下载链接。你能指导我具体应该做什么吗?
    最近更新 更多