HaskellWiki

Haskell | Wiki community | Recent changes
Random page | Special pages

 

Not logged in
Log in | Help

WxHaskell/Building

(Redirected from WxHaskell/Install)

< WxHaskell

Categories: WxHaskell

Contents

1 Building from sources

In principle we recommend the use of binary releases, but wxHaskell also has a build system to compile directly from sources. The build process has been specialized for three main platforms:

wxHaskell has been build successfully on (at least) the following configurations:

(Unfortunately, there are still build problems on Sun Solaris – we are looking for build volunteers :-)

2 Prerequisites

Ensure you have a recent GHC compiler – version 6.8.1 is recommended (but any version >= 5.04.3 will work). In principle, any Haskell98 compiler that supports the standard FFI libraries will also work.

Next, you should install the previous stable version (2.6.4) of wxWidgets for your platform. (wxHaskell doesn't support latest stable version (currently 2.8.4) now.) We assume in this guide that the variable $wxwin points to your wxWidgets installation directory, for example: ~/dev/wxGTK-2.6.4.

If you have a source release of wxHaskell, just unpack it in a suitable directory. In the following descriptions, we assume that the variable $wxhaskell points to your installation directory, for example: ~/dev/wxhaskell.

(Note: GHC 6.6.x or higher can't build old source releases. So you must get source from darcs by below command.)

If you do not have a source release of wxHaskell, you need to check it out from the darcs repository. Darcs creates a wxhaskell directory for you; we assume in the following example that your $wxhaskell directory will be ~/dev/wxhaskell.

> cd ~/dev
> darcs get --set-scripts-executable http://code.haskell.org/wxhaskell/

3 Getting wxWidgets

wxHaskell 0.10.x does not yet support wxWidgets 2.8 (on the other hand, the current darcs version of wxhaskell only supports it). Generally, the recommended version to use is 2.6.4 [2.6.3 on Debian/Ubuntu Linux] as it's what the binaries are compiled against.

See the wxWidgets site for more details.

3.1 building wxWidgets on Windows

For those who wish to build wxHaskell directly on Windows, this section describes how to build the wxWidgets prerequisite using standard GNU tools -- there is a separate section on building the library with Microsoft Visual C++ on windows.

According to the wxWidgets preferred installation, create a mybuild directory in the wxWidgets directory, and run configure and make from that directory (and take the time to get some coffee :-).

> cd $wxwin
> mkdir mybuild
> cd mybuild
> ../configure --enable-unicode
> make
> make install
> cd contrib/src
> make
> make install

Notes:

Now try out a few samples of wxWidgets to see if it all works correctly:

> cd ../../samples/controls
> make
> ./controls

Note that you build from the local samples directory that resides in the mybuild directory.

And also try if wx-config works too:

> wx-config --version

4 Building wxHaskell

First, we configure the library for your platform.

> cd $wxhaskell
> ./configure --enable-split-objs --hcprof

Notes:

After configuration, we build and install the libraries (and take some more time to drink more coffee :-).

> make
> make install
> make wx
> make wx-install

Notes:

5 Test wxHaskell

If everything succeeded, you should be able to run a test program.

> cd samples/wx
> ghc -package wx -o helloworld HelloWorld.hs
> ./helloworld

Notes:

macosx: Unfortunately, wxHaskell programs do not work directly as generated by GHC. Look at the MacOS X notes for more information. You can also run the examples from GHCi – a great development environment!

> ghci -package wx BouncingBalls.hs
> main

Notes:

wxHaskell programs are not always properly reïnitialized when started the second time from a GHCi prompt. This is due static variables in the wxWidgets C++ code, and we are working with wxWidgets developers to remove those bugs. Currently, GHCi only works well with wxWidgets 2.4.2. gtk: Unfortunately, one can only start a wxWidgets program once with GHCi on GTK (rendering it useless). macosx. You need to use a special command to run wxHaskell applications, see the Mac OS X notes from more information. Have fun!

Retrieved from "http://haskell.org/haskellwiki/WxHaskell/Building"

This page has been accessed 200 times. This page was last modified 20:27, 7 August 2008. Recent content is available under a simple permissive license.