Dear wxHaskell users / aspiring users,

These are a few notes from getting a working 64bit installation of wxHaskell on 
Mac OS in case they are of any use to anyone.

- This is for a 64-bit configuration starting from having 64-bit ghc 7.0.4  (HP 
2011.4.0.0 64) 

- Mac os 10.6.8 snow leopard (with xcode 3.2.6)

(This is not currently listed as a "known working configuration" at )

wxHaskell version issue:
There is a linking problem with using the current wxc- and 
wxcore- from Hackage. 
They install ok but ghci throws a load of 'undefined symbols' when compiling 
from haskell using wxcore or wx .
Thanks to Jeremy O'D. for identifying that the problem should disappear again 
in the latest development versions,
which I got from:

So the following installation was completed:

1. wxWidgets 2.9.3      
-----> installed globally (as dylib) in /usr/local...

2.  cabal-macosx-0.2.2  (cabal install from Hackage)
3.  wxdirect-    (cabal install from Hackage)
4.  wxc-           <===<<< Development version from Github
5.  wxcore-       <===<<< Development version from Github
6.  wx-            (cabal install from Hackage)
(plus some additional dependency packages pulled in by cabal not shown) 

Stayed with wxWidgets 2.9.3 as being the current advertised 'stable' 
development release. 

2.9 needed with wxHaskell 0.90 for 64bit.

homebrew/macports may offer a convenient alternative approach to getting 
I'm not familiar with these and don't have either installed so I just built 
wxWidgets myself as follows:

Downloaded direct from   page 
(tar.bz2) to a local
user directory.

Configure to avoid any potential problems that may arise from
by temporarily editing out all inclusions of the QuickTime framework in the 
"configure" script file in the top level wxWidgets
directory (only two places, simplest just to remove in both cases).
- A response to a wxWidgets forum post suggested that the mac-related stuff is 
developing all the time and
  advocated pulling the latest widgets development build, but I stuck to 2.9.3 
in the interests of stability. 
- Another small potential advantage to taking the latest widgets development 
build may be getting changeset 71086 
   which aims to stop the inclusion of the QuickTime framework for i86_64-ONLY 
widgets builds. 

Mac Snow-Leopard evidently (usually) comes with wxWidgets 2.8 pre-installed.  
I didn't want to alter the default Mac pre-installed stuff as far as possible, 
so adopted a configuration which left the 
2.8 libraries installed and only disabled the 2.8 "wxrc" and "wx-config" 
executables in the path.

If you want to check in advance for unlikely clashes with pre-existing stuff, 
then check /usr/local/lib where the dylib files
"libwx_osx_cocoau_*"  and a "wx" directory will be placed.   /usr/local/bin 
will get new "wx-config" and "wxrc*"

Assuming my setup is standard,  wx-config for 2.8 should be found in the path 
at /usr/bin/wx-config and is a symlink to 
the main 2.8 stuff which is in /usr/lib so simply remove this link:      $ sudo 
rm -iv /usr/bin/wx-config

There is also wxrc which is a link to wxrc-2.8 in the same directory, so remove 
the link but leave wxrc-2.8 there:
$ sudo rm -iv /usr/bin/wxrc

(These links can then simply re-created to re-instate path access to the 2.8 
executables if wanted again in the future.)

Create and cd to suitably named wxWidgets build subdirectory, then:

$ ../configure --enable-macosx_arch=x86_64 --enable-unicode --disable-debug 
--with-osx_cocoa --enable-stc --enable-aui --enable-propgrid --enable-xrc 
--enable-ribbon --enable-richtext --enable-webkit --with-opengl
$ make
$ sudo make install

(/usr/local is the default prefix in "configure")

Check with command:

$ wx-config --list

    Default config is osx_cocoa-unicode-2.9

$ wx-config --version

Further checks:

1. cd to the wxWidgets samples and demos folders and "$ make" in each to check 
the samples and demos are working plausibly 
    (I found a couple of odd things but generally were working).

2. Build "minimal.cpp" from


Dependency chain wx -> wxcore -> wxc -> wxdirect

Note: this is for a local user install.

get master commit  Merge branch 'GHCI_FIX_BRANCH'  (at time of writing) eg. via 

wxdirect & cabal-macosx

$ cabal install wxdirect cabal-macosx


cd to "wxc" folder of local copy from github

The following configure parameters are based on
but with an amendment to docdir to bring it in line with my local cabal config.

$ runhaskell Setup configure --user 
--libsubdir= --datasubdir= 
$ runhaskell configure build
$ runhaskell configure install


$ runhaskell Setup configure --user 
--libsubdir= --datasubdir= 
$ runhaskell configure build
$ runhaskell configure install

Build wxcore "HelloWorld.hs" from
Wrap it with the macosx-app command.

Note: It may start with the window positioned out of sight below left hand 
corner of the screen, don't miss it!

This should have been a simple "cabal install wx" but for some strange reason I 

                    Could not find module `Graphics.UI.WXCore':
                          Perhaps you haven't installed the profiling libraries 
for package `wxcore-'?
                          Use -v to see a list of the files searched for.
              cabal: Error: some packages failed to install:
              wx- failed during the building phase. The exception was:
              ExitFailure 1

$ cabal install wx --disable-library-profiling

...seems to solve it.

Build wx "HelloWorld.hs" from

Final Caveat
I have so far only compiled and run simple 'helloworld' type programs using 
wxcore and wx, so not more widely tested yet.

YMMV/ Henry

Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
wxhaskell-users mailing list

Reply via email to