1
votes

I have decided to try to install gtk2hs on my Windows 8 (64 bit) machine. I am relying on the lastest Haskell Platform distribution.

So, I go on the wiki, and follow the instructions. I get gtk+ 32-bit distribution, version 2.24, in the all in one bundle. I unpack it correclty, set up PATH to point to gtk/bin, and create INCLUDE and LIB variables to point respectively to gtk/include and gtk/lib (this step does not seem necessary, but it can't hurt!)

I then verify all is in order by invoking

pkg-config --modversion gtk+-2.0 

and the terminal happly chirps back

2.24.10 

Great!

Then, I run cabal install

gtk2hs-buildtools

and that also goes well. But then, when I run cabal install gtk, it complains that glib fails to install, because it can't find some C dependencies. I try to isolate the problem by running

cabal install glib

and get the following:

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

But this is utter crap! I KNOW the libraries are there. I can see them, in the gtk/bin folder! I re-check my path, and all is good. They are visible, in path. so is include, and lib. All of it. And yet, cabal complains it can't find them.

But this isn't the scariest bit yet...I download the 64-bit of the library, version 2.16...simply swap the two gtk folders...and now, cabal happly builds the whole thing! Of course, it's unsuable, because ghc on the plaftorm is 32-bit and the libraries are 64-bit, so ghc fails to link against it...but at least cabal was pleased.

I then remove glib, cairo, pango, gtk etc, and go about trying installing again, 2.16, 32-bit. And surely, cabal complains about C dependencies missing.

At this point, befuddled by this kafkian situation, I turn to the wisdom of stack overflow! Is cabal trolling me? Are the error messages misleading? Or am I missing something obvious? Thanks to all for the help!

1

1 Answers

1
votes

If you are using 64 bit version of GHC, you want to use 64 bit version of gtk as well.

You can download it on this link. Scroll down a bit and download 2.x (not 3.x) all in one bundle, don't download 2.16: http://www.gtk.org/download/win64.php

Above is no longer an option. You can try installing MSYS and than using MSYS console with pacman package manager to install gtk dev library on windows (I haven't tried it yet though). This pretty much sucks in my opinion.