Building from source on Windows

Instructions for building from source on Windows

  1. make sure you have GHC installed.
  2. install MinGW and MSYS from mingw.org.

    MinGW provides a version of gcc and Windows development headers. MSYS is a unix style shell that we will need to run the configuration program and run the build process.

    (If you would rather use cygwin, it would probably work too but it has not been tested.)

  3. install Gtk+ from gladewin32.sourceforge.net.
    • You can use any version however the 2.10 version is now recommended and as a bonus it also has a much better native windows look, especially on Windows XP.
    • You must install Gtk+ into a directory with no spaces in the name (i.e. not under “C:/Program Files/”).
    • When installing Gtk+ you must select to “Register Environment Variables” and install “Devel headers/libraries”.
    • Glade is Gtk’s visual GUI builder tool. You don’t need to install it but is good to have if you will be developing your own GUIs.
  4. download the Gtk2Hs source tarball into the directory where you want to build it, then from an MSYS shell window:

    $ cd [dir where you downloaded it]
    $ tar -xzf gtk2hs-0.9.11.tar.gz
    $ cd gtk2hs-0.9.11
    $ ./configure –prefix=C:/Gtk2Hs
    $ make
    $ make install
    $ make installcheck #optional, this compiles all the demos

You’re done! You will now be able to compile and run Haskell programs that use Gtk2Hs.

Note that the prefix passed to ./configure cannot be a MinGW style path, however it must use Unix-style ‘/‘ path seperators rather than ordinary Windows ‘\‘ characters.

5 Responses to “Building from source on Windows”

  1. Martijn Schrage Says:

    The hyperlink in step 3 doesn’t work anymore.

  2. Duncan Says:

    The hyperlink in step 3 doesn’t work anymore.

    Fixed thanks!

  3. Conal Says:

    I tried building via cygwin, and got stuck at the configure step. I got much further with msys.

  4. Dex Says:

    I am trying building with cygwin. Configuration is completed successfully but ‘Make’ is not working it says: “bash: make:command not found”
    can you suggsst somthing?

  5. Dex Says:

    Now i tried with MSYS.It Failed at make istall with following errors.
    ***********
    Reading package info from “C:/Gtk2Hs/lib/gtk2hs/cairo.package.conf” … done.
    ghc-pkg.exe: cannot find libHScairo.a on library path (use –force to override)
    Reading package info from “C:/Gtk2Hs/lib/gtk2hs/gtk.package.conf” … done.
    ghc-pkg.exe: dependency cairo-0.9.11 doesn’t exist (use –force to override)
    Reading package info from “C:/Gtk2Hs/lib/gtk2hs/soegtk.package.conf” … done.
    ghc-pkg.exe: dependency gtk-0.9.11 doesn’t exist (use –force to override)
    Reading package info from “C:/Gtk2Hs/lib/gtk2hs/glade.package.conf” … done.
    ghc-pkg.exe: dependency gtk-0.9.11 doesn’t exist (use –force to override)
    Reading package info from “C:/Gtk2Hs/lib/gtk2hs/gtkglext.package.conf” … done.
    ghc-pkg.exe: dependency gtk-0.9.11 doesn’t exist (use –force to override)
    make[2]: *** [install-data-hook] Error 1
    make[2]: Leaving directory `/c/gtk2hs-0.9.11′
    make[1]: *** [install-data-am] Error 2
    make[1]: Leaving directory `/c/gtk2hs-0.9.11′
    make: *** [install-am] Error 2
    **************************
    what can i do?