##### Views

(Difference between revisions)
 Revision as of 22:13, 13 April 2012 (edit) (New page: === Building wxHaskell === For all platforms installation is straightforward, provided that: # wx-config is somewhere in the path # The WXWIN environment variable points to the root of yo...)← Previous diff Revision as of 22:19, 13 April 2012 (edit) (undo)Next diff → Line 35: Line 35: to allocate 512 MB to the GHC RTS. This has been reported to be sufficient. to allocate 512 MB to the GHC RTS. This has been reported to be sufficient. + + === Source Release === + + You can obtain a source release of wxHaskell from the [http://code.haskell.org/wxhaskell/ 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 --lazy --set-scripts-executable http://code.haskell.org/wxhaskell/ + + If you are building on Windows, you will need the version of wx-config which is + included in the wx-config-win directory. You should put this somewhere in your path. + + You then build each of the key components in order: + + > cd ~/dev/wxhaskell/wxdirect + > cabal install --user + > cd ../wxc + > cabal install --user + > cd ../wxcore + > cabal install --user + > cd ../wx + > cabal install --user + + === 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''': wxHaskell programs need to be turned into application bundles before they can be run. Look at the Mac OS X [[WxHaskell/Building_on_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 can be run from GHCi. There are reports that this is now working correctly, at least for Windows and OSX platforms. + + '''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 [[WxHaskell/Building_on_MacOS_X|notes]] from more information. + Have fun! + + [[Category:wxHaskell|Building]] ## Revision as of 22:19, 13 April 2012 ## Contents ### 1 Building wxHaskell For all platforms installation is straightforward, provided that: 1. wx-config is somewhere in the path 2. The WXWIN environment variable points to the root of your wxWidgets installation 3. WINDOWS PLATFORMS ONLY: You may also need to set WXCFG=gcc_dll\mswu You can then install wxhaskell as follows (in a Windows cmd.exe shell, not an MSys shell): > cabal update > cabal install wx  Note that on Windows 7 machines, your command window must be running as Administrator, or you must use the '--user' flag to install to a local directory. Note that on Unix systems, you may prefer something like > sudo cabal install --global wx  Windows developers who don't update environment variables can do something like this in an MS-DOS shell: > Set CPLUS_INCLUDE_PATH=C:\MinGW\include\c++\3.4.5;C:\MinGW\include\c++\3.4.5\mingw32\ > Set WXWIN=C:\path\to\wxWidgets-2.9.3 > Set WXCFG=gcc_dll\mswu > cabal install wx  The Windows installation is global by default. #### 1.1 Out of memory errors There have been reports of out of memory errors when compiling wxcore on some machines, notably 64 bit Linux hosts. Wxcore contains some very large auto-generated source files, and increasing the memory available to the GHC runtime can help. Try something like: > export GHCRTS='-M512m'  to allocate 512 MB to the GHC RTS. This has been reported to be sufficient. ### 2 Source Release You can obtain a source release of wxHaskell 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 --lazy --set-scripts-executable http://code.haskell.org/wxhaskell/

If you are building on Windows, you will need the version of wx-config which is included in the wx-config-win directory. You should put this somewhere in your path.

You then build each of the key components in order:

> cd ~/dev/wxhaskell/wxdirect
> cabal install --user
> cd ../wxc
> cabal install --user
> cd ../wxcore
> cabal install --user
> cd ../wx
> cabal install --user


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: wxHaskell programs need to be turned into application bundles before they can be run. Look at the Mac OS 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 can be run from GHCi. There are reports that this is now working correctly, at least for Windows and OSX platforms.

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!