【问题标题】:Haskell dependency hellHaskell 依赖地狱
【发布时间】:2018-09-02 12:37:15
【问题描述】:

我正在尝试在 Haskell 项目中包含特定版本的库。该库是床和早餐(用于 martix 操作),但我需要特定版本 0.4.3,它修复了乘法实现的错误。

所以,我的 stack.yaml 看起来像这样:

flags: {}
extra-package-dbs: []
packages:
- .
extra-deps:
- bed-and-breakfast-0.4
- base-4.6.0.1
resolver: lts-12.8

但是我在构建时遇到了这个错误:

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

In the dependencies for bed-and-breakfast-0.4:
    base-4.11.1.0 from stack configuration does not match >=4.5 && <4.7  (latest matching version
                  is 4.6.0.1)
needed due to realworldhaskell-0.1.0.0 -> bed-and-breakfast-0.4

Some different approaches to resolving this:


  * Set 'allow-newer: true' to ignore all version constraints and build anyway.

  * Consider trying 'stack solver', which uses the cabal-install solver to attempt to find some
    working build configuration. This can be convenient when dealing with many complicated
    constraint errors, but results may be unpredictable.

  * Recommended action: try adding the following to your extra-deps
    in C:\Users\info\Desktop\Projects\haskell\stack.yaml:

- base-4.6.0.1

我已完成建议的操作,但没有解决任何问题。我尝试使用不同的解析器来查看我的 GHCi 版本是否存在问题,但没有任何效果。解释此类错误消息的最佳方法是什么?我应该如何继续?

编辑:

如果我删除 -base.4.6.0.1 并添加 allow-newer: true 我得到这个:

WARNING: Ignoring out of range dependency (allow-newer enabled): base-4.11.1.0. bed-and-breakfast requires: >=4.5 && <4.7
bed-and-breakfast-0.4: configure
Progress 1/2

--  While building custom Setup.hs for package bed-and-breakfast-0.4 using:
      C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.2.0.1_ghc-8.4.3.exe --builddir=.stack-work\dist\7d103d30 configure --with-ghc=C:\Users\info\AppData\Local\Programs\stack\x86_64-windows\ghc-8.4.3\bin\ghc.EXE --with-g
hc-pkg=C:\Users\info\AppData\Local\Programs\stack\x86_64-windows\ghc-8.4.3\bin\ghc-pkg.EXE --user --package-db=clear --package-db=global --package-db=C:\sr\snapshots\76fd1958\pkgdb --package-db=C:\Users\info\Desktop\Projects\haskell\
.stack-work\install\8c390635\pkgdb --libdir=C:\Users\info\Desktop\Projects\haskell\.stack-work\install\8c390635\lib --bindir=C:\Users\info\Desktop\Projects\haskell\.stack-work\install\8c390635\bin --datadir=C:\Users\info\Desktop\Proj
ects\haskell\.stack-work\install\8c390635\share --libexecdir=C:\Users\info\Desktop\Projects\haskell\.stack-work\install\8c390635\libexec --sysconfdir=C:\Users\info\Desktop\Projects\haskell\.stack-work\install\8c390635\etc --docdir=C:
\Users\info\Desktop\Projects\haskell\.stack-work\install\8c390635\doc\bed-and-breakfast-0.4 --htmldir=C:\Users\info\Desktop\Projects\haskell\.stack-work\install\8c390635\doc\bed-and-breakfast-0.4 --haddockdir=C:\Users\info\Desktop\Pr
ojects\haskell\.stack-work\install\8c390635\doc\bed-and-breakfast-0.4 --dependency=array=array-0.5.2.0 --dependency=base=base-4.11.1.0 --dependency=binary=binary-0.8.5.1 --dependency=deepseq=deepseq-1.4.3.0 --dependency=template-hask
ell=template-haskell-2.13.0.0 --extra-include-dirs=C:\Users\info\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\include --extra-lib-dirs=C:\Users\info\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\min

gw64\bin --extra-lib-dirs=C:\Users\info\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\lib --exact-configuration
    Process exited with code: ExitFailure 1
    Logs have been written to: C:\Users\info\Desktop\Projects\haskell\.stack-work\logs\bed-and-breakfast-0.4.log

    Configuring bed-and-breakfast-0.4...
    Cabal-simple_Z6RU0evB_2.2.0.1_ghc-8.4.3.exe: The package has an impossible
    version range for a dependency on an internal library: bed-and-breakfast
    ==0.3.2. This version range does not include the current package, and must be
    removed as the current package's library will always be used.

编辑 2:

好的,所以我猜住宿加早餐库需要包含在 GHCi 6.10.2 中的基础 4.11.1.0(根据 https://wiki.haskell.org/Base_package),所以我需要一个与该 GHCi 版本匹配的解析器。在哪里可以找到解析器版本?

【问题讨论】:

  • 您无法更改base 版本,它已与ghc 连接,因此请尝试从extra-deps 中删除- base-4.6.0.1 并设置allow-newer: true
  • 我认为您需要使用另一个 snapshot(解析器 lts-12.8 可能不兼容)。
  • 是的,我尝试将我的解析器设置为早期版本,但这就像一个猜谜游戏。有什么合乎逻辑的方法可以找出我需要的解析器吗?
  • 嗨!我是bed-and-breakfast 的作者,我刚刚发布了 0.5,应该可以解决这些问题。
  • 不错的 Scravy - 这个周末我会去看看!

标签: haskell haskell-stack


【解决方案1】:

这是对最新可用的bed-and-breakfast 包的限制:base (&gt;=4.5 &amp;&amp; &lt;4.7),这意味着它甚至可能无法使用高于 7.6 的 GHC 版本进行编译。考虑到在 GHC 7.8 之前甚至没有 LTS 快照,你对那个包不走运。

换句话说,包已经过时了,你的选择是:

  • 提交一个问题,希望维护者能做点什么
  • 尝试自己使用较新的 ghc
  • 使用不同的包

【讨论】:

  • 对,这实际上是我得出的可能结论之一。我听说 HMatrix 是一个不错的选择,但是当我将它作为依赖项包含在内时,构建失败告诉我我缺少 OpenBLAS(经过一些挖掘后看起来我需要安装 mingw 并设置大量 C 依赖项......在那里在不构建 C 库等的情况下设置所有这些的任何更简单的方法?
  • 是的,切换到 Linux ;) 开个玩笑。 HMatrix 是 OpenBLAS 的一个包装器,因此如果您想使用该包,则无法绕过它。根据您需要的操作,还有其他可能适合您的数组操作库。我是massiv包的作者,但它还没有包含很多代数运算,但它是纯Haskell,所以需要外部依赖。
  • 我实际上正是因为这个原因才开始切换到 linux; windows是一个非常烦人的工作环境......但是,vidya游戏xD我会看看你的massiv包(大声笑......),它是开源的(即如果我使用纯haskell滚动我自己的矩阵运算你如果它们与您的包主题匹配,可能会考虑通过 PR 将它们合并?)
  • 是的,它是开源的。你可以在 hackage 和 github.com/lehins/massiv 上找到它,我很乐意接受 PR,但在开始工作之前,可能值得为你可能想要添加的内容打开一个问题。
  • @ThomasCook 请注意,即使在 Windows 上,您也可以经常使用 pacman (stack exec pacman) 来获取必要的依赖项。不确定 OpenBLAS 是否可用,但值得一试。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-12-21
  • 1970-01-01
  • 2021-06-26
  • 1970-01-01
  • 2015-12-20
  • 2012-04-08
相关资源
最近更新 更多