Saturday, January 15, 2011

Setting up a Haskell development environment on Windows

This blog post describes how to set up a basic Haskell development environment on Windows. This is the setup I use to make sure that the network package continues to work on Windows.

The Haskell Platform has everything you need to get started, but it doesn't allow you to build certain packages that require Unix tools, like autotools. For that, you need MSYS (or Cygwin, but the former works better.)

Installing MSYS

  1. Install the latest Haskell Platform. Use the default settings.

  2. Download version 1.0.11 of MSYS. You'll need the following files:

    The files are all hosted on haskell.org as they're quite hard to find in the official MinGW/MSYS repo.

  3. Run MSYS-1.0.11.exe followed by msysDTK-1.0.1.exe. The former asks you if you want to run a normalization step. You can skip that.

  4. Unpack msysCORE-1.0.11-bin.tar.gz into C:\msys\1.0. Note that you can't do that using an MSYS shell, because you can't overwrite the files in use, so make a copy of C:\msys\1.0, unpack it there, and then rename the copy back to C:\msys\1.0.

  5. Add C:\Program Files\Haskell Platform\VERSION\mingw\bin to your PATH. This is neccesary if you ever want to build packages that use a configure script, like network, as configure scripts need access to a C compiler.

You now have a basic Haskell development setup and you should be able to install more packages using the cabal command line tool.

2 comments:

  1. If you have any experience with getting haskell-SDL working in windows, it would be most helpful.

    ReplyDelete
  2. First of all, thank you for this post, Johan. I'm struggling to get some OpenCV software to compile with the new haskell platform, and using cmd.exe is killing me.

    Regarding the last comment (about SDL), I have it running. To anyone with questions about getting SDL to work in windows: send me an email. I know it's an old post, but it appears close to the top when people google for haskell and windows.

    Ivan Perez @ Keera Studios

    ReplyDelete