Network library patches

Hi I finally got the network library (darcs) building, installing and basically working on Windows with GHC 6.12.1. To do this I set up my environment as follows: 1) Install Cygwin 1.7 (include autoreconf) 2) Install GHC 6.12.1 3) export PATH=/cygdrive/c/ghc/ghc-6.12.1/mingw/bin:$PATH I then did the network steps: 1) Grab network from darcs 2) autoreconf 3) Apply the patch attached, which just changes the .cabal file 4) Change all instances of CALLCONV to stdcall 5) cabal install Please can you apply the attached patch, which should be compatible with Linux/Mac too. I found lots of references to CALLCONV all over the place, but couldn't figure out where it started/ended up - my attempts at #define were rather unsuccessful. Could you please change the logic so Windows gets stdcall as standard? I'm happy to test any patches you come up with. Having a working network library on Windows will be really nice, as it's stopped me upgrading to GHC 6.12.1 for a while now. Thanks, Neil

1) Install Cygwin 1.7 (include autoreconf) .. 4) Change all instances of CALLCONV to stdcall 5) cabal install
Please can you apply the attached patch, which should be compatible with Linux/Mac too. I found lots of references to CALLCONV all over the place, but couldn't figure out where it started/ended up - my attempts at #define were rather unsuccessful. Could you please change the logic so Windows gets stdcall as standard?
That part rings a bell, as the opengl binding had the same issue when dropping out of ghc's extralibs: those packages tend to be integrated into ghc's build system (or one version thereof), which sets things like CALLCONV. This particular setting tended to happen (ghc's build system has changed since I last looked, and I can't check right now) in configure (generated from configure.ac), by simply checking the build's $host variable for '*-mingw32'. This doesn't work when building on cygwin (even when using the mingw tool chain, configure will see cygwin as the host), and the simple workaround was only documented for ghc builds, not for the packages depending on ghc's build system. If that information is still relevant, you should be able to get around the CALLCONV issue when building from cygwin by passing a configure option. Here is the example that used to do the trick for building opengl/glut from cygwin: cabal install opengl glut --configure-option="--host=i386-unknown-mingw32" --reinstall A better solution would be for configure to test for the gcc tool chain, not the host environment, before setting CALLCONV. Might apply to other packages that have dropped out of the old extralibs. Hope this helps, Claus

Hi,
I like Windows. I like networks. I love GHC 6.12.1. Having all three
in combination would be fantastic :-)
Given the Haskell platform will certainly include network (as an
ex-GHC package), does anyone from the haskell-platform team want to
pick up the Windows pieces and put together a working network?
I've got a locally patched version of network, which I'm using with
great success - but that's not much benefit to the rest of the
community.
Thanks, Neil
On Tue, Feb 16, 2010 at 11:10 PM, Claus Reinke
1) Install Cygwin 1.7 (include autoreconf)
..
4) Change all instances of CALLCONV to stdcall 5) cabal install
Please can you apply the attached patch, which should be compatible with Linux/Mac too. I found lots of references to CALLCONV all over the place, but couldn't figure out where it started/ended up - my attempts at #define were rather unsuccessful. Could you please change the logic so Windows gets stdcall as standard?
That part rings a bell, as the opengl binding had the same issue when dropping out of ghc's extralibs: those packages tend to be integrated into ghc's build system (or one version thereof), which sets things like CALLCONV. This particular setting tended to happen (ghc's build system has changed since I last looked, and I can't check right now) in configure (generated from configure.ac), by simply checking the build's $host variable for '*-mingw32'.
This doesn't work when building on cygwin (even when using the mingw tool chain, configure will see cygwin as the host), and the simple workaround was only documented for ghc builds, not for the packages depending on ghc's build system.
If that information is still relevant, you should be able to get around the CALLCONV issue when building from cygwin by passing a configure option. Here is the example that used to do the trick for building opengl/glut from cygwin:
cabal install opengl glut --configure-option="--host=i386-unknown-mingw32" --reinstall
A better solution would be for configure to test for the gcc tool chain, not the host environment, before setting CALLCONV. Might apply to other packages that have dropped out of the old extralibs.
Hope this helps, Claus

Hi Neil,
Sorry about not getting back to you earlier, things have been quite hectic
around here.
On Wed, Mar 3, 2010 at 10:26 PM, Neil Mitchell
Hi,
I like Windows. I like networks. I love GHC 6.12.1. Having all three in combination would be fantastic :-)
Given the Haskell platform will certainly include network (as an ex-GHC package), does anyone from the haskell-platform team want to pick up the Windows pieces and put together a working network?
I think we need a co-maintainer for network that actually uses Windows daily and has the time and experience to have the library keep up with changes affecting that platform (i.e. new versions of GHC and/or Windows). I have a local Windows XP install in a virtual machine that I use for testing before making releases but using it is quite painful.
I've got a locally patched version of network, which I'm using with great success - but that's not much benefit to the rest of the community.
In your original email you mentioned that you changed all the occurrences of CALLCONV to stdcall. While this makes everything compile for you it is the wrong thing for other platforms which don't use stdcall. The CALLCONV define is supposed to expand to the right thing for each platform and it has worked in the past and it worked the last time I tried it on Windows XP/GHC 6.12. We need to figure out why it doesn't work for you. Cheers, Johan

Hi Johan,
Sorry about not getting back to you earlier, things have been quite hectic around here.
Here too :-)
I think we need a co-maintainer for network that actually uses Windows daily and has the time and experience to have the library keep up with changes affecting that platform (i.e. new versions of GHC and/or Windows). I have a local Windows XP install in a virtual machine that I use for testing before making releases but using it is quite painful.
Agreed. Alas, that is not me. If the platform has network, then someone in the platform team might be best. If network was in the platform and worked reliably then I'd rather never compile/install network, since I usually use it only as a dependency to other packages I use.
In your original email you mentioned that you changed all the occurrences of CALLCONV to stdcall. While this makes everything compile for you it is the wrong thing for other platforms which don't use stdcall. The CALLCONV define is supposed to expand to the right thing for each platform and it has worked in the past and it worked the last time I tried it on Windows XP/GHC 6.12. We need to figure out why it doesn't work for you.
I know my fix is Windows only, I wasn't aiming for portability, just simplicity. As Claus subsequently said, --configure-option="--host=i386-unknown-mingw32" makes it work for me, so perhaps the configure script is getting the wrong platform? Thanks, Neil

Hi Neil,
I had a little bit of time to look into this today. Unfortunately I
don't have a solution for your problem yet.
On Wed, Mar 24, 2010 at 7:33 AM, Neil Mitchell
Agreed. Alas, that is not me. If the platform has network, then someone in the platform team might be best. If network was in the platform and worked reliably then I'd rather never compile/install network, since I usually use it only as a dependency to other packages I use.
Network is in the platform and has been since the start. Are you seeing problems when installing the platform as well? The platform team cannot maintain the packages in the platform, there are too many packages and the list is expected to grow (while the platform group most likely won't grow by much).
I know my fix is Windows only, I wasn't aiming for portability, just simplicity. As Claus subsequently said, --configure-option="--host=i386-unknown-mingw32" makes it work for me, so perhaps the configure script is getting the wrong platform?
Here are the relevant lines from network's configure.ac: case "$host" in *-mingw32) EXTRA_SRCS="cbits/initWinSock.c, cbits/winSockErr.c, cbits/asyncAccept.c" EXTRA_LIBS=ws2_32 CALLCONV=stdcall ;; *-solaris2*) EXTRA_SRCS="cbits/ancilData.c" EXTRA_LIBS="nsl, socket" CALLCONV=ccall ;; *) EXTRA_SRCS="cbits/ancilData.c" EXTRA_LIBS= CALLCONV=ccall ;; esac AC_SUBST([CALLCONV]) If anyone could figure out a better test than this we could change it. Cheers, Johan
participants (3)
-
Claus Reinke
-
Johan Tibell
-
Neil Mitchell