Personal tools

Views

WxHaskell/Cygwin

From HaskellWiki

This page is kept for historical purposes only, to install wxHaskell on Windows, see WxHaskell/Windows

1 Unix on Windows

To build wxHaskell on windows, you need the cygwin environment to provide essential unix tools necessary to run configure and make, i.e. sh, test, sed, gnu make etc. The cygwin environment provides these tools on windows and these notes describe how to properly install these tools. To compile wxWidgets properly without using Microsoft Visual C++, you also need to install the mingw compiler, as described in the section after installing cygwin. Please note that the compilation of wxWidgets also works without the mingw compiler, but all programs linked with it will fail mysteriously!

2 Install Cygwin

Download the setup program from the cygwin site. When prompted for the packages to install, click also on the Devel and Archive node until they show install (instead of default).

After installation, you need to set a few environment variables. In the following description you should replace the variable $cygwin with your cygwin installation directory (c:\cygwin by default). Set your local environment variables (via start/settings/control panel/system/advanced/environment variables) to the following values:

Add the following directories to your PATH: $cygwin\bin and $cygwin\usr\local\lib. On my system this looks like:

Finally, you can start a bash command prompt, either via the cygwin icon or by typing bash on the windows command line. To access the c: drive conveniently from the bash command prompt, you can mount the /c directory. You only have to do this once:

> mount c: /c

From now on, you can access the c: drive via /c, for example: cd /c/windows

Cygwin make 3.81 is no more recognizing the DOS style paths. You need to install a 3.80 version that you can get from paracoda or mono-project. Once your cygwin installation is working, you can install the older make with:

3 Installing Mingw

In order to compile dynamic link libraries that should work with GHC, we also need the minimalist gnu compiler, called mingw. Compiling with this compiler has the extra advantage that the resulting executables or no longer dependent on the cygwin dll.

Download the latest compiler from the mingw site. There are a lot of packages available but you only need the MinGW package.

After installation, you still need to adapt the cygwin environment in order to use the mingw compiler by default. In the following description, you should replace the $mingw variable with the mingw installation directory (c:\mingw by default).

Add the $mingw/bin directory to the start of your PATH environment variable. It is important that it comes before the $cygwin/bin directory. On my system this looks like:

PATH = %PATH%;c:\programs\mingw\bin;c:\programs\cygwin\bin;...

Edit the file $cygwin/etc/profile and add the $mingw/bin directory to the exported PATH. You should use a unix style directory name. On my system this looks like:

To see if your installation was succesfull, you should retrieve the version of the C compiler and see if the result contains the word mingw:

~$gcc --version
gcc.exe (GCC) 3.2 (mingw special 20020817-1)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

In constrast, if you have done something wrong, you would see something like:

~$/c/programs/cygwin/bin/gcc --version
gcc (GCC) 3.2 20020927 (prerelease)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.