Introduction to Functional Programming -- Installing Gtk2HsTDA555 / DIT440, LP1, HT2012
Home | Schedule | Labs | Exercises | Exam | AboutFire | Forum | TimeEdit | Links | 2011
Here follow installation instructions for Gtk2Hs, for both Windows and Ubuntu.

Please understand that we can provide very limited support if you are having problems with this. If you need help, chances are that someone else has had similar issues; so use the course forum for help!


Installing Gtk2Hs on Windows at home

Step-by-step instructions.

1. Download the Haskell Platform installer for Windows from http://hackage.haskell.org/platform/windows.html and install it using the default settings (just keep clicking 'next.')

2. Download the latest all-in-one bundle for Gtk2Hs from here: http://www.gtk.org/download-windows.html (that's 2.20 at the time of writing) and unpack it to C:\gtk

3. Download MinGW, a GNU command line environment that is required to build Gtk2Hs, from here: http://sourceforge.net/projects/mingw/files_beta/Automated%20MinGW%20Installer/ and install it to C:\MinGW. Use the default settings for everything else (that is, keep clicking next after you've entered C:\MinGW as the install path.)

4. Add the GTK and MinGW binaries to your path environment variable; the exact process differs slightly depending on your Windows version, but on Windows 7, instructions are as follows:
a) Right-click the My computer icon, either on the desktop or in the start menu, and choose "properties" in the menu. Click the "advanced system settings" link in the left pane, then click the "advanced" tab and finally the "environment variables" button.
b) In the lower list box, select the entry that says "Path" in the "Variable" column (the one on the left) and click the "edit" button below it.
c) In the dialog box that pops up, enter "C:\MinGW\bin;C:\gtk\bin;<whatever was in the box before>" without the quotes. For example, if the previous value was "C:\windows\system32;D:\utils\bin" the new value should be "C:\MinGW\bin;C:\gtk\bin;C:\windows\system32;D:\utils\bin". DO NOT forget the semicolons!

On Windows XP, the process is pretty much the same except that you skip the "click the advanced system settings link" step.

5. Start a command shell (for example by entering "cmd" in the "run" field of the start menu and hitting return.)

6. In the command shell, run the following commands, waiting for each one to finish, in sequence:

cabal update
cabal install gtk2hs-buildtools
cabal install gtk

7. Congratulations - you should now have a working Gtk2Hs install!



Installing Gtk2Hs on Ubuntu at home

There are two possibilities:

  • You have already installed the Haskell Platform

    If you have done that, you can install Gtk2Hs by typing the following three commands:

    cabal update
    cabal install gtk2hs-buildtools
    cabal install gtk
    

  • You have not installed the Haskell Platform

    If you do not have the Haskell Platform on your Ubuntu machine, the easiest way to install gtk2hs on an Ubuntu computer is to just install the libghc6-gtk-dev package. This can be done by searching for it in the Synaptic Package Manager, or simply typing this in the shell:

    sudo apt-get install libghc6-gtk-dev
    
    If you install gtk2hs in this way, you will have to give the flag -package gtk when you run ghci or ghc:
    ghc -package gtk --make MyProgram