如何在Windows上安装cairo

11

我真的想不出如何在Windows上安装cairo!

我需要它来使用Haskell Charts,但是当我按照设置说明进行操作并运行时:

cabal install gtk

我遇到了这个错误:

Linking dist/setup-wrapper\setup.exe ...
Configuring glib-0.12.2...
setup.exe: The program pkg-config version >=0.9.0 is required but it could not
be found.
cabal.exe: Error: some packages failed to install:
cairo-0.12.2 failed during the configure step. The exception was:
ExitFailure 1
gio-0.12.2 depends on glib-0.12.2 which failed to install.
glib-0.12.2 failed during the configure step. The exception was:
ExitFailure 1
gtk-0.12.2 depends on glib-0.12.2 which failed to install.
pango-0.12.2 depends on glib-0.12.2 which failed to install.
如果我去cairo网站(http://cairographics.org/download/),它们没有任何设置的地方。只有一堆dll文件,我不知道该怎么处理(如何让Haskell看到它们)。
非常感谢任何帮助,因为我已经花了几个小时来安装这个东西!

错误似乎很明显(在上面的第三行):“setup.exe:需要程序包pkg-config版本>=0.9.0,但找不到它”。 - Ken White
我认为这种安装方式需要整个构建环境。从您提供的cairo页面可以看出,DLL的使用听起来很容易:“只需将libcairo-2.dll、libpng13.dll和zlib1.dll放入您的工作目录或系统PATH中即可”。 - madth3
3个回答

5
您需要下载可在此处找到的全套捆绑包:这里。您可以通过访问http://www.gtk.org/并单击“下载”,然后单击“Windows(32位)”来自行发现此链接。将其提取到不包含空格的目录中,并将该目录添加到您的PATH中。在尝试cabal install gtk之前,您还需要cabal install gtk2hs-buildtools
这些说明也可以在gtk2hs网站上找到

4
这次我做得更进一步了 - 我成功安装了gtk!但是当我运行cabal install chart时,仍然出现以下错误: Loading package cairo-0.12.2 ... linking ... ghc.exe: C:\Users\drozzy\AppData\Roaming\cabal\cairo-0.12.2\ghc-7.0.4\HScai ro-0.12.2.o: unknown symbol '_cairo_image_surface_get_data' ghc.exe: unable to load package 'cairo-0.12.2' cabal.exe: Error: some packages failed to install: Chart-0.15 failed during the building phase. The exception was: ExitFailure 1 - Andriy Drozdyuk

1

嗯,我认为GTK开发人员并没有停止支持Windows之类的事情。他们仍然有一个Windows的下载页面,只是建议使用MSYS2。在我看来,这非常有道理,比手动安装dll文件要容易得多。 - leftaroundabout
看起来他们已经将 @leftaroundabout 提到的Windows安装页面移动到了这里:https://www.gtk.org/docs/installations/windows/。 - Sean Kearon

0

我不是100%确定,但你可能需要先执行

cabal install gtk2hs-buildtools

然后才能安装gtk本身。


做到了。我的问题是我没有将链接到gtk bin目录的路径放在我的路径中。然而,现在我遇到了另一个问题。请看我在@Daniel的答案下的评论。 - Andriy Drozdyuk

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接