WxHaskell/Install

From HaskellWiki
Jump to: navigation, search

Overview

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.

Building and installing

Windows

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':
http://www.haskell.org/pipermail/glasgow-haskell-bugs/2005-October/005632.html
And I found a solution here:
http://www.haskell.org/pipermail/glasgow-haskell-bugs/2005-October/005639.html

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.

Mac OSX

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 and compile 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 build it
    • I used: sh ./configure --wx-config=/usr/local/bin/wx-config --with-opengl && make && sudo make install && make wx && sudo make wx-install
  • (to be continued)

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

Unknowns

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

Linux

Debian

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:

Gentoo

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)

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).