安装gtk2hs-buildtools的问题

时间:2014-03-12 19:59:27

标签: haskell ubuntu gtk cabal

我正在尝试为Haskell安装gtk3,但是我遇到了gtk2hs-buildtools的问题。我正在遵循these条款。当我跑第一行时:

sudo apt-get install libgtk2.0-dev libpango1.0-dev libglib2.0-dev libcairo2-dev

我明白了:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
libcairo2-dev is already the newest version.
libgtk2.0-dev is already the newest version.
libpango1.0-dev is already the newest version.
libglib2.0-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

哪个好,但是当我跑步时:

cabal install gtk2hs-buildtools

我明白了:

Resolving dependencies...
Configuring gtk2hs-buildtools-0.12.5.1...
Warning: This package indirectly depends on multiple versions of the same
package. This is highly likely to cause a compile failure.
package gtk2hs-buildtools-0.12.5.1 requires array-0.4.0.1
package deepseq-1.3.0.1 requires array-0.4.0.1
package containers-0.5.0.0 requires array-0.4.0.1
package deepseq-1.3.0.2 requires array-0.5.0.0
package unix-2.6.0.1 requires bytestring-0.10.0.2
package unix-2.7.0.0 requires bytestring-0.10.4.0
package time-1.4.0.1 requires deepseq-1.3.0.1
package process-1.1.0.2 requires deepseq-1.3.0.1
package containers-0.5.0.0 requires deepseq-1.3.0.1
package bytestring-0.10.0.2 requires deepseq-1.3.0.1
package time-1.4.2 requires deepseq-1.3.0.2
package bytestring-0.10.4.0 requires deepseq-1.3.0.2
package process-1.1.0.2 requires directory-1.2.0.1
package gtk2hs-buildtools-0.12.5.1 requires directory-1.2.0.1
package unix-2.6.0.1 requires time-1.4.0.1
package random-1.0.1.1 requires time-1.4.0.1
package directory-1.2.0.1 requires time-1.4.0.1
package unix-2.7.0.0 requires time-1.4.2
package directory-1.2.0.1 requires time-1.4.2
package process-1.1.0.2 requires unix-2.6.0.1
package directory-1.2.0.1 requires unix-2.6.0.1
package directory-1.2.0.1 requires unix-2.7.0.0
Building gtk2hs-buildtools-0.12.5.1...
Preprocessing executable 'gtk2hsTypeGen' for gtk2hs-buildtools-0.12.5.1...
[1 of 2] Compiling Paths_gtk2hs_buildtools ( dist/build/autogen/Paths_gtk2hs_buildtools.hs, dist/build/gtk2hsTypeGen/gtk2hsTypeGen-tmp/Paths_gtk2hs_buildtools.o )
[2 of 2] Compiling Main             ( hierarchyGen/TypeGen.hs, dist/build/gtk2hsTypeGen/gtk2hsTypeGen-tmp/Main.o )
Linking dist/build/gtk2hsTypeGen/gtk2hsTypeGen ...
Preprocessing executable 'gtk2hsHookGenerator' for
gtk2hs-buildtools-0.12.5.1...
[1 of 2] Compiling Paths_gtk2hs_buildtools ( dist/build/autogen/Paths_gtk2hs_buildtools.hs, dist/build/gtk2hsHookGenerator/gtk2hsHookGenerator-tmp/Paths_gtk2hs_buildtools.o )
[2 of 2] Compiling Main             ( callbackGen/HookGenerator.hs, dist/build/gtk2hsHookGenerator/gtk2hsHookGenerator-tmp/Main.o )
Linking dist/build/gtk2hsHookGenerator/gtk2hsHookGenerator ...
Preprocessing executable 'gtk2hsC2hs' for gtk2hs-buildtools-0.12.5.1...
<command line>: cannot satisfy -package-id directory-1.2.0.1-b345fe37c722587c0267eb05e0b3a77a: 
    directory-1.2.0.1-b345fe37c722587c0267eb05e0b3a77a is shadowed by package directory-1.2.0.1-91a788fd88acd7f149f0f10f5f1e23f2
    (use -v for more information)
Failed to install gtk2hs-buildtools-0.12.5.1
cabal: Error: some packages failed to install:
gtk2hs-buildtools-0.12.5.1 failed during the building phase. The exception
was:
ExitFailure 1

检查我的cabal版本:

cabal -V

给出:

cabal-install version 1.18.0.3
using version 1.18.1.3 of the Cabal library 

我还确保在.zshrc中包含:

export PATH=$HOME/.cabal/bin:$PATH

关于发生了什么的任何想法?

3 个答案:

答案 0 :(得分:1)

“官方”指导是你应该使用你的包管理器来安装你想要的任何Haskell东西,而不是cabal(-install)*。你没有说你的发行版是什么,但我注意到在Debian Sid中有一个gtk2hs-buildtools。所以你应该做apt-get gtk2hs-buildtools;他们已经解决了依赖问题。仅对您自己的代码使用cabal

*就个人而言,我手动安装GHC,并使用cabal-install来处理与Haskell相关的所有内容,但那是因为我需要很多东西的最新版本。当你开始混合两个你遇到麻烦的时候真的。

答案 1 :(得分:1)

一开始,cabal告诉你:

Warning: This package indirectly depends on multiple versions of the same
package. This is highly likely to cause a compile failure.

如果查看依赖项的版本,它们就不匹配。地狱开始了!

如果您想使用gtk3我建议使用github存储库,请参阅安装说明(链接末尾):https://github.com/vincenthz/gtk2hs 因为gtk和gtk3库具有相同的名称模块(import Graphics.UI.Gtk),所以ghc将不知道选择哪一个...

希望它有所帮助!

答案 2 :(得分:1)

系统上安装了两个版本的directory包。另一个版本可能已作为不同包的依赖项安装。您应该尝试在沙箱中构建软件包,看看是否存在问题。

$ mkdir temp # A temporary directory

$ cd temp

$ cabal sandbox init # Initialize a sandbox

$ cabal install gtk2hs-buildtools

一般建议是在不同的沙箱中安装软件包,以使它们的依赖关系不会相互衔接。

有关沙箱的更多信息,请查看here


如果这不能解决问题,那么您可能会对(use -v for more information)行感兴趣。

使用-v安装可以让您知道directory的哪两个版本正在发生碰撞以及它们的安装位置。其中一个可能来自包管理器的系统安装。