Sunday, April 17, 2011

Installing gtk2hs 0.12 for the latest Haskell Platform on the Windows 7

This post only comments the original tutorial from haskell.org and describes extra action, one should perform to successfully install the Gtk bindings to Haskell without MinGW.


So, steps, you should perform:



  1. Read the original documentation on how to install Haskell for Windows


  2. Download all required files, mentioned im this document


  3. Install the Gtk to the location without spaces in the filenames. So the default location (C:\Program Files\Gtk+) won't work.


  4. Run command-line prompt, fill the INCLUDE and PKG_CONFIG_PATH with correct paths to Gtk+ and libxml2.


  5. run cabal install --ghc-option=-DCABAL_VERSION_MINOR=10 gtk



This is not all.


Now, some packages fails to register with error:


Registering cairo-0.12.0...
setup.exe: internal error: unexpected package db stack: [UserPackageDB]

This is because of bug (or mistake?) in Gtk2hsSetup.hs. So for these packages you should unpack them (e.g. cabal unpack cairo), move to the unpacked directory and change the following code in the Gtk2hsSetup.hs (line 199 of the file):


#if CABAL_VERSION_CHECK(1,10,0)
installedPkgInfo pkg lbi inplace [packageDb]
#else
installedPkgInfo pkg lbi inplace packageDb
#endif

to


#if CABAL_VERSION_CHECK(1,10,0)
installedPkgInfo pkg lbi inplace (withPackageDB lbi)
#else
installedPkgInfo pkg lbi inplace packageDb
#endif

Than, in the package root directory type:


cabal install --ghc-option=-DCABAL_VERSION_MINOR=10

Other errors I've faced with, and the solutions


Error in compiling pango package, the compiler couldn't find glib/glib.h file.


In the file pango-0.12.0\Graphics\Rendering\Pango\Struts.hsc change


#include <glib/glib.h>

to


#include <glib.h>

Error in compiling gio package, some names aren't defined (wmDriveStopButton, DriveStartStopType, DriveStartFlags)


This is because in the module exports these names are present, but defined in a body with macro:


#if GLIB_CHECK_VERSION(2,22,0)
...
#endif

My solution, is to wrap the definitions of these exports in the same macro. Fortunately this will not break the compilation.


After all these steps you should have a working installation of the Gtk2Hs. To check this, you could build and run examples from the gtk-0.12.0\demo directory.

7 comments:

  1. Thank you for posting this, was very helpful to me.

    ReplyDelete
  2. Anyone who needs a new idea to stay motivated should
    definitely try this. It will help the prospective health
    and fitness aspirant keep pace with the ever evolving world of fitness.

    Stretching will help you prevent injuries and it will help you loosen up your muscles.


    Feel free to surf to my weblog linked site

    ReplyDelete
  3. This video post is actually great, the noise quality and the picture feature of
    this tape post is really amazing.

    my website; hot-sexy-chat.de

    ReplyDelete
  4. I've listened to this a dozen or more times and still find it delightful and sooooo original in concept. " Earlier today some cruise ship struck land in Alaska. Thus they can choose from the many available sources.

    Have a look at my page; Latest Daily News

    ReplyDelete
  5. Based on my own experiences I am going to make five recommendations that I wish someone had made to me to help take the fear out of
    fitness. It will help the prospective health
    and fitness aspirant keep pace with the ever
    evolving world of fitness. If the answer is I''''''ll do whatever takes''''''''.


    Look into my weblog :: just click the up coming web site

    ReplyDelete
  6. I visit day-to-day some blogs and websites to read articles,
    except this weblog gives quality based writing.

    Here is my site: fitness tips women

    ReplyDelete
  7. In this competitive world, news information is like knowledge recourses that educate us about various world wide activities and the activity within the society, even in the surrounding etc.
    Indeed, internet is the best source of because it is easily accessible and fast.
    The facility of websites and online news are also getting lot of appreciation
    because it is very time saving and people can read it in between their work.


    my blog post :: Latest Daily News

    ReplyDelete