【问题标题】:GTK2HS fails to install with recent cabal versionsGTK2HS 无法安装最新的 cabal 版本
【发布时间】:2013-10-24 15:45:45
【问题描述】:

我正在开始一个有望使用 gtk2hs 的新项目。但是,我无法让这个包安装在我相当典型的 Linux 机器上。这是失败:

[1 of 2] Compiling SetupWrapper     ( /tmp/cairo-0.12.4-4201/cairo-0.12.4/SetupWrapper.hs, /tmp/cairo-0.12.4-4201/cairo-0.12.4/dist/dist-sandbox-58b5f9c6/setup/SetupWrapper.o )

/tmp/cairo-0.12.4-4201/cairo-0.12.4/SetupWrapper.hs:94:45:
    Ambiguous occurrence `moreRecentFile'
    It could refer to either `SetupWrapper.moreRecentFile',
                             defined at /tmp/cairo-0.12.4-4201/cairo-0.12.4/SetupWrapper.hs:149:1
                          or `Distribution.Simple.Utils.moreRecentFile',
                             imported from `Distribution.Simple.Utils' at /tmp/cairo-0.12.4-4201/cairo-0.12.4/SetupWrapper.hs:8:1-32

/tmp/cairo-0.12.4-4201/cairo-0.12.4/SetupWrapper.hs:95:45:
    Ambiguous occurrence `moreRecentFile'
    It could refer to either `SetupWrapper.moreRecentFile',
                             defined at /tmp/cairo-0.12.4-4201/cairo-0.12.4/SetupWrapper.hs:149:1
                          or `Distribution.Simple.Utils.moreRecentFile',
                             imported from `Distribution.Simple.Utils' at /tmp/cairo-0.12.4-4201/cairo-0.12.4/SetupWrapper.hs:8:1-32
Failed to install cairo-0.12.4
[1 of 2] Compiling SetupWrapper     ( /tmp/glib-0.12.4-4201/glib-0.12.4/SetupWrapper.hs, /tmp/glib-0.12.4-4201/glib-0.12.4/dist/dist-sandbox-58b5f9c6/setup/SetupWrapper.o )

/tmp/glib-0.12.4-4201/glib-0.12.4/SetupWrapper.hs:94:45:
    Ambiguous occurrence `moreRecentFile'
    It could refer to either `SetupWrapper.moreRecentFile',
                             defined at /tmp/glib-0.12.4-4201/glib-0.12.4/SetupWrapper.hs:149:1
                          or `Distribution.Simple.Utils.moreRecentFile',
                             imported from `Distribution.Simple.Utils' at /tmp/glib-0.12.4-4201/glib-0.12.4/SetupWrapper.hs:8:1-32

/tmp/glib-0.12.4-4201/glib-0.12.4/SetupWrapper.hs:95:45:
    Ambiguous occurrence `moreRecentFile'
    It could refer to either `SetupWrapper.moreRecentFile',
                             defined at /tmp/glib-0.12.4-4201/glib-0.12.4/SetupWrapper.hs:149:1
                          or `Distribution.Simple.Utils.moreRecentFile',
                             imported from `Distribution.Simple.Utils' at /tmp/glib-0.12.4-4201/glib-0.12.4/SetupWrapper.hs:8:1-32
Failed to install glib-0.12.4

这似乎与最近的 cabal 版本有关,因为以前可以使用。这似乎是一个已知的错误(http://trac.haskell.org/gtk2hs/ticket/1292http://trac.haskell.org/gtk2hs/ticket/1291http://trac.haskell.org/gtk2hs/ticket/1289),但它已经好几个星期没有移动了。我没有足够的能力提出一个好的解决方案,所以我想听听你的建议。这很烦人,因为我被困在这个重要的项目上,想到我们语言的主要 GUI 库已经坏了好几个星期了,我感到很痛苦。

使用 Cabal 库 / ghc 7.4.1 的 1.18.1.1 版安装 1.18.0.2 版

感谢您的帮助

【问题讨论】:

  • 您可以编辑 Setup.hs 并将其更改为使用显式导入。
  • 您可以从您的错误消息中看到问题出在cairo 包中,在文件SetupWrapper.hs 中,该文件定义了函数moreRecentFile,但还从Distribution.Simple.Utils(阴谋集团图书馆的一部分)。大概这是自 cairo 包经过测试以来添加到 cabal 的一个新功能。 Here 是我通过快速谷歌搜索找到的补丁;不知道状态。
  • 谢谢。事实上,问题的根源很容易解决。我从未使用过 setup.hs 文件,我想这让我很困惑。我可能会走这条路,也许会尝试在上游修复。

标签: haskell gtk cabal gtk2hs


【解决方案1】:

目前正确的解决方案是从 darcs 构建。安装说明的Getting the latest and greatest部分给出了详细说明;简短的版本是:

darcs get --lazy http://code.haskell.org/gtk2hs
cd gtk2hs
sh bootstrap.sh

编辑: 2013 年 12 月的 gtk2hs 官方 0.12.5 版本支持 cabal 1.18,因此不再需要上述 darcs 说明。完整的安装说明仍可从Gtk2Hs download page 获得;简短的版本是:

cabal install gtk2hs-buildtools
cabal install gtk gtk3

【讨论】:

  • 谢谢丹尼尔。我是 gtk2hs 的新手,你知道他们是否计划很快在 Hackage 上发布错误修复?我来这里的部分动机是为每个人解决这个问题,而不仅仅是为我。问候,
  • 执行此操作时,我得到:“至少缺少以下依赖项:cairo >=0.12.0 &&
  • @JeremyKnees 请打开一个包含完整详细信息的新问题。正是您尝试过的,完整的错误输出等。试图将所有相关信息塞进评论中只会是痛苦和难以理解的。
  • 这是在修复发布到 hackage 之前要走的路。对于使用 cabal 沙箱的人,我建议从 bootstrap.hs 文件中创建一个“bootstrap-sandbox”,为所有包共享相同的沙箱,以便它们构建良好。谢谢丹尼尔。
  • 嗨@DanielWagner。请你帮我理解是什么阻止了 Hackage 的固定版本的发布?谢谢
【解决方案2】:

您可以使用cabal install --cabal-lib-version=1.16.0 gtk 尝试使用较旧的Cabal 版本。

【讨论】:

  • @jozefg 它说cabal-install 它应该使用什么Cabal 版本来编译Setup.hs。这会有所帮助,因为moreRecentFileCabal-1.16.0 中不存在。 moreRecentFile 的问题不止一个,几周前我尝试安装 gtk2hs--cabal-lib-version 技巧是我找到的最简单的解决方案。
  • 感谢 Yuras 的提示。如果我真的很着急,我可能会使用它,但我现在的主要目标是为每个人整理和修复它。
猜你喜欢
  • 2021-12-20
  • 2018-10-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-08-07
  • 2020-08-01
  • 2022-06-14
相关资源
最近更新 更多