Gtk2Hs/Windows
From HaskellWiki
(→Common Errors: promote section) |
(please don't use this page any more) |
||
| (2 intermediate revisions not shown.) | |||
| Line 1: | Line 1: | ||
| + | <span style="color:red">Please read and update [[Gtk2Hs/Installation]] instead.</span> | ||
| + | |||
== Windows 7 32 bit == | == Windows 7 32 bit == | ||
| Line 17: | Line 19: | ||
> set VAR=dir1;dir2.... | > set VAR=dir1;dir2.... | ||
| - | + | === Install Haskell Platform and MingW === | |
* Install the [http://hackage.haskell.org/platform/windows.html Haskell Platform] for Windows. | * Install the [http://hackage.haskell.org/platform/windows.html Haskell Platform] for Windows. | ||
* Optional : Install [http://mingw.org MinGW] as per the instructions on their web site. Also install MSYS and mingw-make. A version of MinGW does come with Haskell Platform but excludes MSYS and 'make'. | * Optional : Install [http://mingw.org MinGW] as per the instructions on their web site. Also install MSYS and mingw-make. A version of MinGW does come with Haskell Platform but excludes MSYS and 'make'. | ||
| - | + | === Install libxml === | |
* Download and unzip the latest libxml2 and libxml2-dev archives from [http://ftp.gnome.org/pub/GNOME/binaries/win32/dependencies/ Gnome]. | * Download and unzip the latest libxml2 and libxml2-dev archives from [http://ftp.gnome.org/pub/GNOME/binaries/win32/dependencies/ Gnome]. | ||
| - | * To the PKG_CONFIG_PATH environment variable add the 'pkgconfig' directory in libxml2-dev. | + | * To the PKG_CONFIG_PATH environment variable add the 'pkgconfig' directory in libxml2-dev\lib. |
* To the INCLUDE environment variable add the path to the 'include' directory from libxml2-dev. | * To the INCLUDE environment variable add the path to the 'include' directory from libxml2-dev. | ||
| - | + | === Install the GTK/Glade bundle === | |
* Download and install the [http://ftp.gnome.org/pub/GNOME/binaries/win32/glade3/3.6/glade3-3.6.7-with-GTK+.exe bundled GTK and Glade binary]. | * Download and install the [http://ftp.gnome.org/pub/GNOME/binaries/win32/glade3/3.6/glade3-3.6.7-with-GTK+.exe bundled GTK and Glade binary]. | ||
* To the PKG_CONFIG_PATH environment variable add the 'pkgconfig' directory. The default path should be "C:\Program Files\Gtk+\lib\pkgconfig". | * To the PKG_CONFIG_PATH environment variable add the 'pkgconfig' directory. The default path should be "C:\Program Files\Gtk+\lib\pkgconfig". | ||
* To the INCLUDE environment variable add the 'libglade-2.0' directory. The default path should be "C:\Program Files\Gtk+\include\libglade-2.0". | * To the INCLUDE environment variable add the 'libglade-2.0' directory. The default path should be "C:\Program Files\Gtk+\include\libglade-2.0". | ||
| - | + | === Install the Haskell bindings === | |
* At the DOS prompt run 'cabal install gtk2hs-buildtools'. | * At the DOS prompt run 'cabal install gtk2hs-buildtools'. | ||
* At the DOS prompt run 'cabal install gtk'. Make sure you have at least 1.5 GB RAM otherwise this compilation will die. | * At the DOS prompt run 'cabal install gtk'. Make sure you have at least 1.5 GB RAM otherwise this compilation will die. | ||
* At the DOS prompt run 'cabal install glade'. | * At the DOS prompt run 'cabal install glade'. | ||
| - | ==== Test the GTK install | + | |
| + | == Self check == | ||
| + | |||
| + | === Test the GTK install === | ||
* In some appropriate temporary directory run 'cabal unpack gtk'. This downloads and unpacks the Haskell sources. | * In some appropriate temporary directory run 'cabal unpack gtk'. This downloads and unpacks the Haskell sources. | ||
** Run the demos (using mingw-make) | ** Run the demos (using mingw-make) | ||
| Line 39: | Line 44: | ||
** Run the demos (manual compilation) | ** Run the demos (manual compilation) | ||
*** In the 'demo' directory, navigate into the 'hello' directory and run 'ghc --make World.hs -o helloworld.exe'. Now run the executable that was created. | *** In the 'demo' directory, navigate into the 'hello' directory and run 'ghc --make World.hs -o helloworld.exe'. Now run the executable that was created. | ||
| - | + | === Test the Glade install === | |
* In some appropriate temporary directory run 'cabal unpack glade'. This downloads and unpacks the Haskell sources. | * In some appropriate temporary directory run 'cabal unpack glade'. This downloads and unpacks the Haskell sources. | ||
** Run the demos (using mingw-make) | ** Run the demos (using mingw-make) | ||
Current revision
Please read and update Gtk2Hs/Installation instead.
Contents |
1 Windows 7 32 bit
1.1 Changing Environment Variables
This installation process involves adding/modifying environment variables. The rest of this subtopic shows you how to do that in Windows.
- Using the Environment Variable GUI
- Click to the Windows symbol on the bottom-left where "Start" used to be
- Right-Click on "Computer", choose "Properties" and click the link for "Advanced System Settings"
- In the *top* window, Click "New" add a variable or click "Edit" to modify an existing one.
- The variable should be a ';' seperated list of directories.
- At the DOS prompt
- To see the current value of variable VAR:
> echo %VAR%
- To modify variable VAR:
> set VAR=%VAR%;dir1;dir2 ...
- To create variable VAR:
> set VAR=dir1;dir2....
1.2 Install Haskell Platform and MingW
- Install the Haskell Platform for Windows.
- Optional : Install MinGW as per the instructions on their web site. Also install MSYS and mingw-make. A version of MinGW does come with Haskell Platform but excludes MSYS and 'make'.
1.3 Install libxml
- Download and unzip the latest libxml2 and libxml2-dev archives from Gnome.
- To the PKG_CONFIG_PATH environment variable add the 'pkgconfig' directory in libxml2-dev\lib.
- To the INCLUDE environment variable add the path to the 'include' directory from libxml2-dev.
1.4 Install the GTK/Glade bundle
- Download and install the bundled GTK and Glade binary.
- To the PKG_CONFIG_PATH environment variable add the 'pkgconfig' directory. The default path should be "C:\Program Files\Gtk+\lib\pkgconfig".
- To the INCLUDE environment variable add the 'libglade-2.0' directory. The default path should be "C:\Program Files\Gtk+\include\libglade-2.0".
1.5 Install the Haskell bindings
- At the DOS prompt run 'cabal install gtk2hs-buildtools'.
- At the DOS prompt run 'cabal install gtk'. Make sure you have at least 1.5 GB RAM otherwise this compilation will die.
- At the DOS prompt run 'cabal install glade'.
2 Self check
2.1 Test the GTK install
- In some appropriate temporary directory run 'cabal unpack gtk'. This downloads and unpacks the Haskell sources.
- Run the demos (using mingw-make)
- If you installed MinGW then in the 'demo' directory, navigate into the 'hello' directory and run mingw32-make.exe. Now run the executable that was created.
- Run the demos (manual compilation)
- In the 'demo' directory, navigate into the 'hello' directory and run 'ghc --make World.hs -o helloworld.exe'. Now run the executable that was created.
- Run the demos (using mingw-make)
2.2 Test the Glade install
- In some appropriate temporary directory run 'cabal unpack glade'. This downloads and unpacks the Haskell sources.
- Run the demos (using mingw-make)
- If you installed MinGW then in the 'demo' directory, navigate into the 'gladetest' directory and run mingw32-make.exe. Now run the executable that was created.
- Run the demos (manual compilation)
- In the 'demo' directory, navigate into the 'gladetest' directory and run 'ghc --make GladeTest.hs -o gladetest.exe'. Now run the executable that was created.
- Run the demos (using mingw-make)
3 Common Errors
- Glade.h is not found
gtk2hsC2hs.exe : glade/glade.h: File does not exist
Probably instead of installing the GTK/Glade bundle you installed them seperately. The GTK/Glade bundle comes with the "include/libglade-2.0" containing a number of header files. For some reason this directory is not included in stand-alone GTK and Glade installers. Install the bundle and add this directory to the INCLUDE environment variable.
- Cabal cannot find gtk2hsC2hs.
Please install gtk2hs-buildtools' first and check that the installdirectory is in your PATH (e.g. HOME/.cabal/bin). cabal: Error: some packages failed to install
Somehow the path to the cabal bin directory has been lost. To the PATH environment variable re-add the cabal bin directory. The default path should be "%USERPROFILE%\AppData\Roaming\cabal\bin".
- Spinner error with the 'notebook' demo
Running the 'notebook' demo in the GTK install gives:
[1 of 1] Compiling Main ( Notebook.hs, Notebook.o ) Notebook.hs:14:35: Not in scope: type constructor or class `Spinner' Notebook.hs:78:13: Not in scope: `spinnerNew' Notebook.hs:101:2: Not in scope: `spinnerStart' Notebook.hs:109:2: Not in scope: `spinnerStop' mingw32-make: *** [notebook] Error 1
This happens because this demo uses the new Spinner widget in GTK 2.22. Since this is not available in GTK 2.16 you get this error.
