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 http://www.haskell.org/haskellwiki/WxHaskell/MacOS_X )

wxHaskell version issue:
There is a linking problem with using the current wxc-0.90.0.3 and wxcore-0.90.0.1 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:    https://github.com/jodonoghue/wxHaskell

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-0.90.0.1    (cabal install from Hackage)
4.  wxc-0.90.0.4           <===<<< Development version from Github
5.  wxcore-0.90.0.3       <===<<< Development version from Github
6.  wx-0.90.0.1            (cabal install from Hackage)
(plus some additional dependency packages pulled in by cabal not shown) 
    

wxWidgets
========
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 wxWidgets.
I'm not familiar with these and don't have either installed so I just built wxWidgets myself as follows:

Downloaded direct from http://wxWidgets.org/downloads/#latest_dev   page (tar.bz2) to a local
user directory.

Configure to avoid any potential problems that may arise from  https://github.com/jodonoghue/wxHaskell/issues/2
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
2.9.3


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 https://github.com/kowey/debug-wx


wxHaskell
========

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 CloneInMac
at https://github.com/jodonoghue/wxHaskell

wxdirect & cabal-macosx
-----------------------------

$ cabal install wxdirect cabal-macosx

wxc
-----

cd to "wxc" folder of local copy from github

The following configure parameters are based on http://www.haskell.org/haskellwiki/Mac_OS_X_Common_Installation_Paths
but with an amendment to docdir to bring it in line with my local cabal config.


$ runhaskell Setup configure --user --prefix=/Users/<YOURSELF>/Library/Haskell/ghc-7.0.4/lib/wxc-0.90.0.4 --libsubdir= --datasubdir= --docdir=/Users/<YOURSELF>/Library/Haskell/ghc-7.0.4/lib/wxc-0.90.0.4/doc
+
$ runhaskell configure build
+
$ runhaskell configure install

wxcore
--------

$ runhaskell Setup configure --user --prefix=/Users/<YOURSELF>/Library/Haskell/ghc-7.0.4/lib/wxcore-0.90.0.3 --libsubdir= --datasubdir= --docdir=/Users/<YOURSELF>/Library/Haskell/ghc-7.0.4/lib/wxcore-0.90.0.3/doc
+
$ runhaskell configure build
+
$ runhaskell configure install


checks
--------
Build wxcore "HelloWorld.hs" from https://github.com/kowey/debug-wx
Wrap it with the macosx-app command.
Enjoy.

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

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

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


$ cabal install wx --disable-library-profiling

...seems to solve it.

checks
--------
Build wx "HelloWorld.hs" from https://github.com/kowey/debug-wx


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