This page describes how to get a working wxHaskell installation on various platforms. This is not as easy as it might be, as the wxHaskell project has not received much attention since around May 2005 (at time of writing). This means that the available binary packages are unlikely to meet your needs, and you will probably have to build from source.
wxHaskell would not build cleanly for me with the most recent variants of wxWidgets. Under Windows, I was successful in compiling against wxWidgets 2.4.2. Mac OSX (Tiger) has a pre-installed version of wxWidgets 2.5, and it is possible to compile against this provided that a patch is applied - see the section on Mac OSX for details.
- For PC running Windows: I recommend wxWidgets 2.4.2. Newer versions are alleged to build, but I (and others) have had problems. If you want to use ghci, you definitely want 2.4.2. Download from Sourceforge. Unless you particularly wish to build from source, the wxMSW-2.4.2-setup.zip download is fine (it provides a Windows installer for most of what you need. Documentation is a separate (and useful) download. You will make your life easier if you install to a path which does not contain spaces - my recollection is that this is not the default provided by the installer.
- For Mac running OSX (Tiger): I recommend the provided pre-installed wxWidgets.
- For Linux: Recommendations welcome...
Obtain wxHaskell sources from Sourceforge.
- The installation of wxWidgets provided with OSX is a Unicode build. The wxHaskell sources you obtained above are not Unicode clean, and will fail to compile on OSX. Eric Kow at Loria has done a lot of work to sort this out. You can download the fruits of this as a single patch to be applied to the wxHaskell distribution at [Eric Kow wxHaskell Unicode Patch (08)].
- wxHaskell does not build cleanly using gcc 4.0 (the OSX default). You will need to switch to gcc 3.3 (sudo gcc_select 3.3) before compiling.
Building and Installing
Assumptions (a.k.a. what I have tested)
- GHC 6.4.2 (Jason Dagit reports success with GHC 6.5 as well).
- Cygwin installation. See | wxHaskell cygwin page for detail, but broadly, you need Cygwin bash and install binaries.
- wxWidgets built/installed in a path with no spaces in it. Actually you can use a path with spaces but there are a few rules. For example, I had ghc installed to this location:
C:\Program Files\Visual Haskell
So this required me to use the following configure command:
The two important things here are: 1) You must use the forward slash and 2) you cannot use spaces.
After wxHaskell installed I started getting panics from 'ghc -package wx':
And I found a solution here:
Next I found that I needed to add C:\Program Files\Visual Haskell to my path so that the wxHaskell dlls could be located by windows.
- Environment variables:
- PATH should include MinGW and Cygwin binary directories. MinGW must come before Cygwin in PATH.
- WXHASKELL environment var points to wxHaskell install directory.
- WXWIN environment directory points to wxWidgets install directory.