Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Haskell 安装gtk2hs构建工具时出现的问题_Haskell_Ubuntu_Gtk_Cabal - Fatal编程技术网

Haskell 安装gtk2hs构建工具时出现的问题

Haskell 安装gtk2hs构建工具时出现的问题,haskell,ubuntu,gtk,cabal,Haskell,Ubuntu,Gtk,Cabal,我正在尝试为Haskell安装gtk3,但在使用gtk2hs构建工具时遇到问题。我遵照指示。当我运行第一行时: 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-de

我正在尝试为Haskell安装gtk3,但在使用gtk2hs构建工具时遇到问题。我遵照指示。当我运行第一行时:

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.
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 install gtk2hs-buildtools
我得到:

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.
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-install version 1.18.0.3
using version 1.18.1.3 of the Cabal library 
我还确保在我的
.zshrc
中包括:

export PATH=$HOME/.cabal/bin:$PATH
有什么想法吗?

官方的指导是,你应该使用你的软件包管理器安装你想要的任何Haskell东西,而不是cabal(-install)*。您没有说您使用的是哪个发行版,但我注意到在Debian Sid中有一个gtk2hs构建工具。因此,您应该
获取gtk2hs构建工具
;他们已经解决了依赖性问题。只能对您自己的代码使用
cabal


*就我个人而言,我手动安装GHC,并使用cabal安装所有与Haskell相关的东西,但那是因为我需要很多东西的最新版本。实际上,当你开始将两者混为一谈时,你会遇到麻烦。

一开始,阴谋集团告诉你:

Warning: This package indirectly depends on multiple versions of the same
package. This is highly likely to cause a compile failure.
如果查看依赖项的版本,它们不匹配。那他妈的开始吧

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


希望有帮助

好的,确实安装了一些东西,但同时执行
sudo apt get install gtk3
cabal install gtk3
安装失败。有什么建议吗?等一下,刚刚注意到顶部的红色信息。。。让我们通读一遍。XD错误消息是什么?(您应该使用
sudo-apt-get-install-gtk3
,而不是
cabal-install-gtk3
)apt-get的错误是:E:找不到包gtk3您是在Debian还是Ubuntu上,还是。。。?