[web-devel] [Haskell-cafe] network-2.3.0.10 compiled for ghc 7.4.1 windows

Alberto G. Corona agocorona at gmail.com
Tue Feb 7 20:54:27 CET 2012


The code is evolving and none of the versions match exactily with the
patch, but substituting HAVE_WINSOCK by HAVE WINSOCK2 in these files
solves the compilation problem at least in the network 2.3.0.10
version from hackage.

However it produces the same undefined references when this library is
imported in my application. It seems that some object code is not
included in the final library.  I verified that at least some of these
undefined references correspond with  C code in the source, but
somehow this is not included in the object library....

2012/2/7 Johan Tibell <johan.tibell at gmail.com>:
> Note that there are two branches on github, master and stable. You want the
> latter.
>
> On Feb 7, 2012 8:23 AM, "Alberto G. Corona" <agocorona at gmail.com> wrote:
>>
>> This is quite different.
>> I don´t know how but I was looking at some other older patch around
>> the same issue and I supposed that it was the one refered by Yohan
>> Tibell.
>>
>> I´ll try your patch.
>>
>> Thanks!.
>>
>> 2012/2/7 Holger Reinhardt <hreinhardt at gmail.com>:
>> > Hi,
>> >
>> > (I submitted the patch that Johan linked to)
>> > Network/Socket/Internal.hsc has the following code:
>> >
>> > #if defined(WITH_WINSOCK) || defined(cygwin32_HOST_OS)
>> > type CSaFamily = (#type unsigned short)
>> > #elif defined(darwin_HOST_OS)
>> > type CSaFamily = (#type u_char)
>> > #else
>> > type CSaFamily = (#type sa_family_t)
>> > #endif
>> >
>> > You have patched this part to always use 'unsigned short'. But the real
>> > issue is that WITH_WINSOCK is not defined, even though it should be. The
>> > reason for this lies in include/HsNet.h:
>> >
>> > #if defined(HAVE_WINSOCK_H) && !defined(cygwin32_HOST_OS)
>> > # define WITH_WINSOCK  1
>> > #endif
>> >
>> > The problem here is that it checks for HAVE_WINSOCK_H, but the configure
>> > script never defines this variable. Instead it defines HAVE_WINSOCK2_H.
>> > It
>> > seems that the network library used Winsock1 in the past and in the
>> > transition to Winsock2 someone forgot to change a few of the #ifdefs.
>> >
>> > My patch just changes all occurences of HAVE_WINSOCK_H
>> > to HAVE_WINSOCK2_H.
>> > You might want to try that and report back if it works for you.
>> >
>> > 2012/2/7 Alberto G. Corona <agocorona at gmail.com>
>> >>
>> >> Hi Johan,
>> >> The patch is not for the current version of network and the code is
>> >> quite different. Basically it is necesary to  define this variable as
>> >> "unsigned short" that is the thing intended in the patch. however I
>> >> put it by brute force, without regard of the prerpocessor directives.
>> >> With this change the code compiles well with:
>> >>
>> >>
>> >>
>> >> http://neilmitchell.blogspot.com/2010/12/installing-haskell-network-library-on.html
>> >>
>> >> However my compiled library lack the methods defined as foreign. I´ll
>> >> keep trying.
>> >>
>> >> 2012/2/6 Johan Tibell <johan.tibell at gmail.com>:
>> >> > Hi,
>> >> >
>> >> > Someone recently contributed a fix that should make network build
>> >> > with
>> >> > 7.4: https://github.com/haskell/network/pull/25
>> >> >
>> >> > Can you see if that works for you? I haven't yet had time to merge
>> >> > and
>> >> > release that fix (I'm on vacation.)
>> >> >
>> >> > -- Johan
>> >> >
>> >>
>> >> _______________________________________________
>> >> Haskell-Cafe mailing list
>> >> Haskell-Cafe at haskell.org
>> >> http://www.haskell.org/mailman/listinfo/haskell-cafe
>> >
>> >



More information about the web-devel mailing list