11

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!

Andriy Drozdyuk
  • 58,435
  • 50
  • 171
  • 272
  • The error seems pretty clear (it's in the third line above): "setup.exe: The program pkg-config version >=0.9.0 is required but it could not be found". – Ken White Mar 02 '12 at 01:08
  • I think that route of installation requires a whole building environment. The DLL usage sounds easy "Just pop libcairo-2.dll, libpng13.dll and zlib1.dll into your working directory or system PATH" (from the cairo page you've linked). – madth3 Mar 02 '12 at 01:49

3 Answers3

5

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.

Daniel Wagner
  • 145,880
  • 9
  • 220
  • 380
  • 4
    I get a little further this time - I manage to install `gtk`! But when I run `cabal install chart` I still get: `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 Mar 02 '12 at 15:00
1

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

markasoftware
  • 12,292
  • 8
  • 41
  • 69
  • Hm, I don't think it's that the GTK people have stopped supporting Windows or something. They still have [a download page for Windows](https://www.gtk.org/download/windows.php), it just recommends that MSYS2 is used. Which, I reckon, makes a lot of sense and is easier than manually installing dll files. – leftaroundabout Dec 05 '18 at 23:45
  • It looks like they've moved the Windows installation page mentioned by @leftaroundabout to here: https://www.gtk.org/docs/installations/windows/ – Sean Kearon Oct 07 '21 at 06:46
0

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

cabal install gtk2hs-buildtools

before you can install gtk itself.

MathematicalOrchid
  • 61,854
  • 19
  • 123
  • 220
  • Did that. My problem was I didn't place the link to gtk `bin` directory in my path. However, now I am encountering another problem. See my comment on @Daniel's answer. – Andriy Drozdyuk Mar 02 '12 at 15:31