Installing wxHaskell on Windows XP

by SkyTreeBird 23-Sept-2010

1 Introduction
After having no luck following the wxHaskell/Building wiki, I decided to take slightly different approach. What follows is the process I went through to get wxHaskell working on Windows XP. It worked for me, hope it helps others.

2 Process
2.1 Install MinGW - Optional
a) Download MinGW – Note: MinGW is a ‘free’ compiler. Because we are going to be using wxPack, which comes with pre-built binaries (ie pre-compiled files) you can skip this section. However, in my experience it is wise to have it installed. b) Run the downloaded executable - Figure 1 shows the recommended setup options.

Figure 1 - MinGW Setup

Page 1 of 4

2.2 Setup wx-config
a) Download wx-config. This is a standalone executable, no install required. b) Create a folder eg ‘C:\wx-config’ and drop the wx-config.exe into it.

2.3 Set Environment Variables
2.3.1 New Variables

a) Left click on Start. b) Right click on My Computer. c) Left click on Properties Advanced Tab Environment Variables…

d) Add the two environment variables shown circled in red in Figure 2 by clicking on New - Note: The value for WXWIN should correspond the actual location where you installed wxWidgets on your computer.

Figure 2 – Create the WXWIN & WXCFG Environment Variables

2.3.2

Modifications to Existing ‘PATH’ Variable

a) Whilst still in the Environment Variables window, double click on the PATH variable. b) Make the following appends, making sure everything is separated by a semi-colon (oh, and be careful not to delete any existing text): C:\MinGW\bin C:\wx-config (ignore if you didn’t install MinGW) (location of wx-config.exe)

eg: existing-text;C:\MinGW\bin;C:\wx-config

Page 2 of 4

2.4 Install wxPack
a) Download wxPack b) Run the wxPack executable. c) From the setup menu, select MinGW Gcc Only (see Figure 3).

Figure 3 - wxPack Setup d) Append the PATH variable as you did in section 2.3.2 with the following text so that your executables can find the DLL’s: C:\wxWidgets2.8.10\lib\gcc_dll (location of your gcc_dll folder)

2.5 Install wxHaskell
a) Open up a Command Prompt and enter the following commands: > cabal update > cabal install wx

Page 3 of 4

2.6 Mind the Gaps…
a) For some reason, when I first tried to run the Hello.hs test program, I was greeted with some ‘mingwm10.dll’ error nonsense. This was solved by making the following ‘additional’ append to the PATH variable (see Section 2.3 for details on how to do this): C:\Program Files\Haskell Platform\2010.2.0.0\mingw\bin b) If you want to avoid any nasty ‘can’t load .so/.DLL for: std c++’ tantrums, I recommend using GHC (as opposed to GHCi) to compile your wxWidgets executables, eg: > ghc –package wx Hello.hs –o hello …or, if you don’t want the annoying Command Prompt popping up every time you run your executable: > ghc –optl-mwindows –package wx Hello.hs –o hello

3 Feedback
Hopefully, everything should be working fine - at least it was for me. I would appreciate peoples feedback on this guide (ie was it helpful / unhelpful) so that I can decide what to do with it (ie scrap it / develop it, put it into a wiki etc). Thanks, SkyTreeBird

Page 4 of 4

Sign up to vote on this title
UsefulNot useful