在Windows上安装gtk2hs的问题

时间:2015-05-07 13:41:46

标签: haskell gtk cabal glib

我决定尝试在我的Windows 8(64位)计算机上安装gtk2hs。我依靠最新的Haskell平台发行版。

所以,我继续使用wiki,并按照说明进行操作。我在一个捆绑包中获得gtk + 32位分发版本2.24。我解压缩它,将PATH设置为指向gtk / bin,并创建INCLUDE和LIB变量分别指向gtk / include和gtk / lib(这一步似乎没必要,但它不会受到伤害!)

然后我通过调用

验证所有内容是否正常
pkg-config --modversion gtk+-2.0 

终端开心地回来了

2.24.10 

大!

然后,我运行cabal install

gtk2hs-buildtools

这也很顺利。 但是,当我运行cabal install gtk时,它抱怨glib无法安装,因为它无法找到一些C依赖项。我尝试通过运行

来隔离问题
cabal install glib

并获得以下内容:

C:\Users\Federico>cabal install glib
Resolving dependencies...
Configuring glib-0.13.1.0...
Failed to install glib-0.13.1.0
Last 10 lines of the build log ( C:\Users\Federico\AppData\Roaming\cabal\logs\gl
ib-0.13.1.0.log ):
[1 of 2] Compiling Gtk2HsSetup      ( Gtk2HsSetup.hs, dist\setup-wrapper\Gtk2HsS
etup.o )
[2 of 2] Compiling Main             ( SetupMain.hs, dist\setup-wrapper\Main.o )
Linking dist/setup-wrapper\setup.exe ...
Configuring glib-0.13.1.0...
setup.exe: Missing dependencies on foreign libraries:
* Missing C libraries: gobject-2.0, gthread-2.0, glib-2.0, intl
This problem can usually be solved by installing the system packages that
provide these libraries (you may need the "-dev" versions). If the libraries
are already installed but in a non-standard location then you can use the
flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.
cabal: Error: some packages failed to install:
glib-0.13.1.0 failed during the configure step. The exception was:
ExitFailure 1

但这是彻头彻尾的废话!我知道图书馆在那里。我可以在gtk / bin文件夹中看到它们!我重新检查我的路径,一切都很好。它们在路径中是可见的。所以是include和lib。所有的。然而,cabal抱怨它无法找到它们。

但这不是最可怕的......我下载了64位的库,版本2.16 ......只需交换两个gtk文件夹......现在,cabal很乐意构建整个东西!当然,它不合适,因为plaftorm上的ghc是32位而且库是64位的,所以ghc无法链接它...但至少cabal很高兴。

然后我删除了glib,cairo,pango,gtk等,然后再次尝试安装,2.16,32位。肯定的是,cabal抱怨缺少C依赖。

此时,被这种kafkian情况迷惑,我转向堆栈溢出的智慧! cabal拖着我吗?错误消息是否具有误导性?还是我错过了一些明显的东西? 感谢大家的帮助!

1 个答案:

答案 0 :(得分:1)

如果您使用的是64位版本的GHC,那么您也希望使用64位版本的gtk。

您可以在此链接上下载。向下滚动一下并在一个包中下载2.x(而不是3.x),不要下载2.16: http://www.gtk.org/download/win64.php

以上不再是一种选择。您可以尝试安装MSYS,而不是使用带有pacman包管理器的MSYS控制台在Windows上安装gtk开发库(虽然我还没试过)。在我看来,这非常糟糕。