Difference between revisions of "WxHaskell/Install"

From HaskellWiki
Jump to navigation Jump to search
Line 139: Line 139:
(users of other arches should use their arch keywrods as appropriate)
(users of other arches should use their arch keywrods as appropriate)
==== Fedora Core 6 ====
There is no wxHaskell package to go with the ghc-6.6 packages. You
will have to compile it yourself. This a simple matter of:
* Installing wxGTK:
** <code>yum install wxGTK-devel</code>
* Getting the sources:
** <code>darcs get http://darcs.haskell.org/wxhaskell</code>
* Configuring, building and installing:
** <code>configure --with-opengl && make && make install && make wx && make wx-install</code>
=== Old wxHaskell installation page ===
=== Old wxHaskell installation page ===

Revision as of 13:25, 23 January 2007


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.

Note further that much of this is getting outdated fast. Current development on wxHaskell takes place in the darcs repository at http://darcs.haskell.org/wxhaskell .

Getting wxWidgets

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): Either download it from wxWidgets.org or install it via MacPorts.
  • For Linux: Recommendations welcome...
  • wxWidgets 2.6.3: Jinwoo Lee, in a mail to wxhaskell-users and haskell-cafe mailing list, claims success in compiling wxHaskell against wxWidgets 2.6.3.
    • Jinwoo writes: "I had problems when compiling wxhaskell 0.9.4 using wxWidgets 2.6.3. And I found out that in wxWidgets 2.6.3, some DB-related field names have changed:
      • columnSize --> columnLength
      • bufferLength --> bufferSize
    • So I modified the file "db.cpp" (wxc/src/db.cpp), and succeeded to compile.

I'm attaching the modified file." (Editor's note: see http://www.haskell.org//pipermail/haskell-cafe/2006-July/thread.html#17042 to obtain the modified db.cpp)

Getting wxHaskell

Obtain wxHaskell sources from Sourceforge.

OSX caveats:

  • The installation of wxWidgets provided with OSX Tiger will not work, as it does not have the wxThread symbols that wxHaskell does want to link against.
  • Programs compiled with wxHaskell do not work by default: you need to run macosx-app on them to let Mac OS X understand that the binary needs Carbon to do its UI.

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:
    ./configure --libdir=C:/Progra~1/Visual~1

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.


MacIntel, Tiger (10.4.8), GHC 6.6, wxWidgets 2.6.3 (MacPorts), wxHaskell 0.10.1-pre

Note: I used the 6.6 binaries from the GHC site, but maybe the MacPorts version will work too.

  • Download and install MacPorts
  • sudo port install wxWidgets
  • darcs get http://darcs.haskell.org/wxhaskell
  • ./configure --wx-config=/opt/local/bin/wx-config
  • Do the standard installation from that point on

PPC, Tiger (10.4.8), GHC 6.6, wxWidgets 2.6.3, wxHaskell 0.10.1-pre

  • Download install wxWidgets for mac (wxMac 2.6.3) from http://www.wxwidgets.org/
    • I used: ./configure --enable-monolithic --enable-display --enable-unicode --with-opengl --with-mac --without-odbc && make && sudo make install
  • Download the sources to wxhaskell 0.10.1-pre
  • Configure wxhaskell and install it
    • I used: sh ./configure --wx-config=/usr/local/bin/wx-config --with-opengl && make && sudo make install && make wx && sudo make wx-install
  • Enjoy. The TimeFlows and BoucingBalls examples still suffer from not having a correct default background color. This should not affect you too much: just explicitly set the background color.

PPC, Tiger (10.4.7), GHC 6.4.1, wxWidgets 2.6.3, wxHaskell 0.9.4

Getting wxHaskell 0.9.4 to work with Wolfgang Thaller's installer for GHC 6.4.1 and wxWidgets 2.6.3 on Tiger (10.4.7 in my case):

  • Download and compile wxWidgets for mac (wxMac 2.6.3) from http://www.wxwidgets.org/
    • I used: ./configure --disable-shared --enable-unicode --with-opengl --with-mac --without-odbc
  • Download and unzip the sources to wxhaskell 0.9.4
  • Download and apply the unicode patch to wxhaskell 0.9.4 from http://www.loria.fr/~kow/download/patch-wxhaskell-unicode-08
    • I used: cd wxhaskell-0.9.4; patch -p1 < ../wxhaskell-unicode.patch; cd ..
  • Change makefile so that line 718 reads: $(CXX) -r -keep_private_externs -nostdlib -o $(WXC-OUTDIR)/master.o $^ $(WXC-LIBS) -lSystemStubs -shared-libgcc -lstdc++-static (don't forget the tab starting the line!)
  • Check to see if you have XCode 2.3 or newer installed; with the above line, compilation will fail with lower versions, due to a lacking libstdc++-static.a
  • Configure wxhaskell and build it
    • I used: ./configure --wx-config=/usr/local/src/wxMac-2.6.3/osx-build/wx-config --with-opengl; make; make install
  • Enjoy, but beware: not everything works cleanly. I'm looking into what causes the BouncingBalls and TimeFlows examples to fail. (20060908)

Panther (10.3), GHC 6.4 (?), wxWidgets 2.6.*, wxHaskell 0.9.4

  • install wxWidgets for mac, wxmac http://www.wxwidgets.org
    • use the --disable-shared option for configure (this isn't needed in all cases?)
      ./configure --disable-shared
  • Make sure you have readline installed. The simplest way is to use fink or darwinports. http://wxhaskell.sourceforge.net/building-macosx.html
  • grab and install wxHaskell
  • (unique to macosx!)
    sudo ln -s /usr/local/wxhaskell/bin/macosx-app /usr/local/bin/
  • See below if you have any trouble


  • Does Fink have a wxWidgets which works with this?
  • Does wxWidgets 2.8.0 work at all?



For Debian Linux systems (as long as there's no .deb package):

  • Fetch the rpm package from http://wxhaskell.sourceforge.net/download.html
  • make sure you have wxWidgets installed (libraries and developer files)
  • if you haven't done this already, install the debian package "alien": apt-get install alien
  • use alien to install the rpm package: alien -i wxhaskell....rpm
  • use ghc-pkg to add the packages wxcore and wx to ghc's package configuration file:
    cd /usr/lib/ghc-6.2.1/wxhaskell-0.7
    ghc-pkg -D wxhlibdir=/usr/lib/ghc-6.2.1/wxhaskell-0.7 -ai wxcore.pkg
    ghc-pkg -D wxhlibdir=/usr/lib/ghc-6.2.1/wxhaskell-0.7 -ai wx.pkg

Another way for Debian systems:
use the repository "deb http://haskell-unsafe.alioth.debian.org/archive/i386 unstable ."

A way that surely works:


wxHaskell is available in portage for x86, amd64, sparc and ppc

ACCEPT_KEYWORDS="~x86" emerge wxhaskell

(users of other arches should use their arch keywrods as appropriate)

Fedora Core 6

There is no wxHaskell package to go with the ghc-6.6 packages. You will have to compile it yourself. This a simple matter of:

  • Installing wxGTK:
    • yum install wxGTK-devel
  • Getting the sources:
  • Configuring, building and installing:
    • configure --with-opengl && make && make install && make wx && make wx-install

Old wxHaskell installation page

  • There is an older wxHaskell installation tips page which may contain information useful for people trying to get wxHaskell installed on older systems (e.g. OSX Panther).