(Update building instruction for wxHaskell 0.11.0)
Revision as of 09:53, 1 January 2009
1 Building wxWidgets and wxc with Microsoft Visual C++
The advantage of using Visual C++ is that the resulting libraries are smaller and faster than the gnu compiled ones. Furthermore, the debug version provides for automatic detection of memory leaks in the wxWidgets libraries and you get a warning when forgetting to deallocate wxWidgets objects. The drawback is that the configure scripts are not used and you will need to set some options manually.
If you want to use Visual C++ Express Edition, you must use Visual C++ 2008 Express Editions or higher. Because previous version requires installing Microsoft Platform SDK before building wxWidgets or wxHaskell.
We use the wxWidgets provided workspace directly:
- wxWidgets 2.8: Open the $wxwin/build/msw/wx.dsw workspace. Select menu "Build/Batch build" and select all configurations by using the mouse and the shift key, when you click a marker, all configurations are deselected. Next you manually select the "Unicode Release" and "Unicode Debug" versions of all projects and press "Build". Afterwards, press "Save All" to save all your mouse clicking work :-)
After building wxWidgets, you need to run configure for the wxHaskell library.
> cd $wxhaskell > ./configure --with-msc
If you want to use the debug version of the library, use the --wxc-libname option too.
> ./configure --with-msc --wxc-libname=wxcd
After configuration, first run make command to generate stc_gen.* files.
Make will stop by following error.
> make: *** No rule to make target `out/wxc/wxc-msw2.8.9-0.11.0.dll', needed by `wxc'. Stop.
Then go $wxhaskell/wxc directory. Here, you need to adapt the wxc-<em>version</em>.dsp project to reference the correct wxWidgets directory. Open the .dsp file in an editor and replace all occurrences of "..\..\wxWindows-2.8.9" or by the installed wxWidgets directory, i.e. $wxwin.
After adapting the project file, you can open the workspace wxc/wxc-<em>version</em>.dsw and build the "Unicode Release" and "Unicode Debug" versions of the C wrapper library.
And finally! ‚Äì you can run make in the $wxhaskell directory to build the Haskell libraries.
> cd $wxhaskell > make > make install > make wx > make wx-install
2 User experiences
2.1 GHC 6.10.1, wxWidgets 2.8.9, wxHaskell 0.11.0 (binary)
- Download the wxhaskell binary from sourceforge
- Unpack wxhaskell-*.zip. And double-click wxhaskell-*\bin\wxhaskell-register.bat.
- wxhaskell-register.bat install wxHaskell to your system.
2.2 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 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:
The two important things here are: 1) You must use the forward slash and 2) you cannot use spaces.
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.
For more detailed information, see Installing wxWidgets 2.8.9 on Microsoft Windows 9x/ME, Windows NT, Windows 2000, Windows XP, and Windows CE.