How to install cairo on Windows

2019-04-23 05:28发布

问题:

For the life of me I can't figure out how to install cairo on Windows!

I need it for Haskell Charts, but when I follow setup instructions and get to running:

cabal install gtk

I get this error:

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.

If I go to cairo site, they don't have anywhere any kind of setup. Just a bunch of dlls that I don't know what to do with (how to make Haskell see them).

Any help appreciated, as I've been trying to install the damn thing for hours!

回答1:

You need to download the all-in-one bundle available here. You can discover this link yourself by visiting http://www.gtk.org/ and clicking "Download", then "Windows (32-bit)". Extract it to a directory that doesn't include spaces, and add that directory to your PATH. You will also need to cabal install gtk2hs-buildtools before you attempt to cabal install gtk.

These instructions can also be found on the gtk2hs website.



回答2:

I'm not 100% sure, but you might need to do

cabal install gtk2hs-buildtools

before you can install gtk itself.



回答3:

This is not an answer to the original question, but to the comment about the unknown symbol for cairo-0.12.2

This is likely the bug mentioned at http://hackage.haskell.org/trac/gtk2hs/ticket/1211 - Basically, if the item you are building is using Template Haskell, it seems to break.

I hit this issue, and was able to work around it by separating the portion of my project using Template Haskell to a separate library, and allowing the main GUI app to call the library.



回答4:

Since the answers on this page have been posted, GTK has stopped publishing Windows binaries. A third party compiles up-to-date dlls here: http://www.tarnyko.net/dl/gtk.htm