Installing on Windows
Instructions for installing on Windows
- Make sure you have GHC 6.6.1 installed. This exact version of GHC is required. If you cannot install either version of GHC you can either use an older version of Gtk2Hs (eg 0.9.11 worked with GHC-6.4.2 and 6.6) or build from source with any supported version of GHC.
- download and run the Gtk2Hs installer gtk2hs-0.9.12.exe
- you can select to install the demo source code and the API documentation
You’re done! You will now be able to compile and run Haskell programs that use Gtk2Hs.
Quick-start Guide
You might like to start by compiling some of the demo programs in the demos folder. For example to compile the noughts and crosses demo, open a console window, change directory to the noughty folder and use ghc --make to compile the demo:
cd "C:\Program Files\Gtk2Hs\demos\noughty"
ghc --make Noughty.hs
This produces Noughty.exe in the same folder (or main.exe if you’re using GHC 6.4.2). When you run this .exe it pops up a console window; you can read about how to stop that happening.
Note that GHCi support is available in this release.
January 26th, 2006 at 1:11 pm
i inquire about support for ghci - is there a workaround (eg. duplicating files or similar) for the window system?
thank you
andrew
March 15th, 2006 at 2:11 pm
I have installed on windows XP latest GTK i.e. gtk-win32-devel-2.8.14-rc1.exe,
also GHC 6.4.1,
and gtk2hs-0.9.10.exe
after compiling demos, I have received next mesage - linking error:
“The procedure entry point gdk:cairo_create dould not be located in the dynamic link library libgdk-win32-2.0-0.dll”
That dll is on PATH, of course.
March 16th, 2006 at 1:16 am
emil: that’s an interestng error. cairo_create is not exported from libgdk-win32-2.0-0.dll
I’ll try installing that version of Gtk+ on my windows machine.
It may be better to continue this conversation on the gtk2hs-users mailing list.
March 17th, 2006 at 4:05 pm
emil,
I had a similiar problem, but a quick search of my drives showed that there were other applications on my path that had a copy of the libgdk-win32-2.0.0.dll that do not have the cairo functions. Once I corrected the search order of my Path variable to pickup the GTK version first, everythong worked fine
Marty
May 14th, 2006 at 7:19 pm
The hyperlink “build from source” in step 1 doesn’t work.
July 27th, 2006 at 3:04 pm
Thanks Dmitry. Fixed.
October 13th, 2006 at 12:48 pm
I installed 6.4.1 (I also have 6.4.2). I changed my system Path on windows to include the ghc bin folder C:\ghc-6.4.1\bin
from a command line I get
$ ghc –version
The Glorious Glasgow Haskell Compilation System, version 6.4.1
but when I run the windows installer it says please install ghc 6.4.1
Where does it look?
Justin
October 13th, 2006 at 12:57 pm
Sorry it just fixed itself
October 13th, 2006 at 12:57 pm
Very sorry, no it didn’t. I was installing ghc again.
October 13th, 2006 at 9:15 pm
Hia Justin, the installer first looks on the path and then in the registry for keys that the ghc installer sets. So it should work if you used the installer, or if you built it yourself then it should work if you set your path appropriately.
If it’s still not working, post to the gtk2hs users list with all the details and we can try and work it out.
October 26th, 2006 at 10:46 pm
I’m receiving the error “The GTK+ libraries are not on the windows search path! …Please reinstall Gtk+ and make sure the “register environment variables” option is selected”. After following that single piece of advice, I’m still getting the error. Please help. (I’m a student taking functional programming and might not know how to do anything very complicated).
Help is much appreciated!!!!!
February 28th, 2007 at 3:52 pm
C:\Program Files\Gtk2Hs\demos\noughty>ghc –version
The Glorious Glasgow Haskell Compilation System, version 6.6
C:\Program Files\Gtk2Hs\demos\noughty>ghc –make Noughty.hs
Noughty.hs:11:7:
Could not find module `Graphics.UI.Gtk’:
Use -v to see a list of the files searched for.
February 28th, 2007 at 7:24 pm
Thanks for the update - it works now!
February 28th, 2007 at 11:39 pm
Yeah, oops, sorry about that
March 1st, 2007 at 12:20 am
I tried to install the windows version, and the installer complains that my existing gtk stuff will be found first in my path. It suggests removing that stuff (not an option) or .. and then it overruns the text box and the scroll bar goes no further so i cannot read the suggested fix. can you tell me where to put your dlls or what to add to my path?
March 1st, 2007 at 10:37 am
Hi clem,
Basically when you run a prog you’ve compiled using the Gtk2Hs lib, that prog needs to be able to find the various Gtk+ .dlls.
If we were distributing a stand alone .exe this would be easy as we’d just put the .exe in the same directory as all the Gtk+ dlls. Indeed you can do this too and it’ll work fine, however it’s not the normal way we expect things to work with GHC. We expect to be able to build a .exe in any directory and have that .exe work without having to move it into a special directory first.
So our current solution is to put the directory containing the Gtk+ dlls into the %PATH% environment variable so that they will be found when you run the .exe you’ve built. For that to work, the Gtk+ ‘bin’ directory has to appear in the %PATH% list before any other directories that might have dlls with the same names.
However if you have another Gtk+ installation that you need to keep in the %PATH% to make some other app work then we have a problem. There are a couple solutions:
1. It might be that the two are compatible. Gtk+ is supposed to be backwards compatible, so having the later version of the Gtk+ dlls appear first in the path may allow both Gtk2Hs progs and your other Gtk+ program(s) to work. It’s worth a go at least. To do that, right click on “My Computer” and select “Properties”. On the “Advanced” tab select the “Environment Variables” button. In the “System Variables” section, edit the “Path” variable and edit so that the Gtk2Hs “bin” directory appears before the similar one for your other Gtk+ installation. Then test if your other Gtk+ app still works. If not, revert your change to the Path variable and try option 2:
2. We could do what Visual Studio does and provide a batch file that sets up a special command line environment to use when developing and running Gtk2Hs programs. This would set Gtk2Hs’s installation of Gtk+ to appear first in the %PATH%, but only for that command line session - not globally for the whole desktop. You can get this effect by doing the following:
You should then be able to compile and run Gtk2Hs program fine, though only from that console session.
Hope this helps!
March 24th, 2007 at 2:01 am
Any chance of a version of the installer that comes with SourceEdit (and I guess the other two options that work)? How much bigger would the build be?
March 24th, 2007 at 2:18 am
Philippa, I think it weighs in at around 15-20Mb rather than 10Mb.
March 25th, 2007 at 8:57 pm
I know I’d be plenty willing to deal with an installer that size if it doesn’t cause too big a problem on your end.
July 27th, 2007 at 8:54 pm
Thanks for the breakdown.. tons of good info.
Bookmarked this page for future reading.
Thanks
Sash Geran
July 28th, 2007 at 12:15 am
Hey man i followed the directions and got an error that says
“please install ghc 6.4.1″
After googling that error … i get nothing that makes sense?
Any clue?
Thanks
July 28th, 2007 at 12:46 am
Mike, are you sure you’re running the 0.9.12 installer? It asks for ghc 6.6.1. I just checked the current installer and it doesn’t mention ghc 6.4.1 anywhere.
Was that the full error message or was there more detail than that?
July 30th, 2007 at 11:36 pm
I’m able to compile the demo programs from the cmd line in Win XP, but I get a linking error for “package glib…” when I try to load the same demo programs in GHCi.