[Haskell-cafe] haskell zlib on win32

Tim Newsham newsham at lava.net
Fri Mar 2 17:54:48 EST 2007

Building haskell's zlib library for win32 is not trivial since
it relies on an external C library.  Most of the required tools
are shipped with the ghc binary distribution though.  I finally
bit the bullet and jumped through the build hoops to install
it.  My notes are attached below.

The build could be nicer if it was more cabalized -- ie. have
the cabal file directly reference the zlib-1.2.3 sources and
headers..  Problems are possible reliance on particular versions,
duplicating already installed code (although in this case its
pretty small), and possibly figuring out how to perform the
"configuration" process without a shell....  Any opinions on
this approach?


I built from cygwin.  Probably a little easier if you have
mingwin installed.

I have ghc-6.6 installed in /c/ghc/ghc-6.6 
(/c is a mount point for c:\   "mount c:\\ /c").

Fetch sources

   $ darcs get http://haskell.org/~duncan/zlib
   $ cd zlib
   $ wget http://www.zlib.net/zlib-1.2.3.tar.gz
   $ tar -xzf zlib-1.2.3.tar.gz

Prefer ghc's gcc (mingwin) rather than cygwins.

   $ export PATH=/c/ghc/ghc-6.6:/c/ghc/ghc-6.6/bin:$PATH

Build zlib C code

   $ ./configure --prefix=/c/ghc/ghc-6.6 --libdir=/c/ghc/ghc-6.6
   $ make install

build haskell zlib

   $ cd ..
   $ runhaskell Setup.py configure
   $ runhaskell Setup.hs build
   $ runhaskell Setup.hs install

Tim Newsham

More information about the Haskell-Cafe mailing list