Casinos Not On GamstopNon Gamstop CasinosBest Non Gamstop Casinos UkNon Gamstop CasinoMigliori Casino Online Europei

anty.info

Comments and help on web development.
18  07 2009

How to compile Haskell’s network library on Windows

The normal way to recompile a Haskell library would be to:

  1. download the Cabal source package e.g. from HackageDB
  2. unpack it in a directory
  3. locate the directory in the console
  4. use “cabal install -reinstall” and watch the compiling process

For the network-2.2.1.3 package I couldn’t use this approach because I always got the message that “getnameinfo” couldn’t be found.

I discovered this mail that lead me to the solution, but was kinda vague in the second step. This is why I’m publishing this post. Here are the 4 steps with a detailed second step:

  1. download the source from HackageDB
  2. modify configure.ac by replacing the first paragraph with the second one:
    dnl Under mingw, we may need to set WINVER to 0x0501 to expose getaddrinfo. if test "x$ac_have_getaddrinfo" = x; then old_CFLAGS="$CFLAGS" if test "z$ac_cv_lib_ws2_32__head_libws2_32_a" = zyes; then CFLAGS="-DWINVER=0x0501 $CFLAGS" AC_MSG_CHECKING(for getaddrinfo if WINVER is 0x0501) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$ac_includes_default int testme(){ getaddrinfo; }]])],[AC_DEFINE([HAVE_GETADDRINFO], [1], [Define to 1 if you have the `getaddrinfo' function.]) AC_DEFINE([NEED_WINVER_XP], [1], [Define to 1 if the `getaddrinfo' function needs WINVER set.]) EXTRA_CPPFLAGS="-DWINVER=0x0501 $EXTRA_CPPFLAGS"; AC_MSG_RESULT(yes)],[CFLAGS="$old_CFLAGS"; AC_MSG_RESULT(no)]) fi fi
    dnl Under mingw, we may need to set WINVER to 0x0501 to expose getaddrinfo. if test "x$ac_have_getaddrinfo" = x; then old_CFLAGS="$CFLAGS" if test "z$ac_cv_lib_ws2_32__head_libws2_32_a" = zyes; then dnl CFLAGS="-DWINVER=0x0501 $CFLAGS" dnl AC_MSG_CHECKING(for getaddrinfo if WINVER is 0x0501) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$ac_includes_default int testme(){ getaddrinfo; }]])],[AC_DEFINE([HAVE_GETADDRINFO], [1], [Define to 1 if you have the `getaddrinfo' function.]) AC_DEFINE([NEED_WINVER_XP], [1], [Define to 1 if the `getaddrinfo' function needs WINVER set.]) EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS"; AC_MSG_RESULT(yes)],[CFLAGS="$old_CFLAGS"; AC_MSG_RESULT(no)]) fi fi
  3. run “autoreconf” in the source directory. If you don’t have autoreconf download msysDTK-1.0.1.exe (or a better version)
  4. run “cabal install -reinstall”

I hope this will save a lost soul some time, one day!


Leave a Reply

« »