darcs patch: s6_addr32 is undefined on darwin. Added an AC check a...

Fri Jun 22 18:58:52 CEST 2007 Thomas Schilling

On Sat, Jun 23, 2007 at 03:12:38PM -0700, Thomas Schilling wrote:
Fri Jun 22 18:58:52 CEST 2007 Thomas Schilling
* s6_addr32 is undefined on darwin. Added an AC check and a definition taken from the NetBSD sources.
This breaks the build on Debian amd64 Linux: ifBuildable/ifBuildable network setup/Setup makefile -f GNUmakefile Reading parameters from /home/ian/ghc/darcs/build2/libraries/network/network.bui ldinfo Preprocessing library network-2.0.1... In file included from BSD.hsc:17: include/HsNet.h:80:1: warning: "s6_addr32" redefined In file included from include/HsNet.h:77, from BSD.hsc:17: /usr/include/netinet/in.h:203:1: warning: this is the location of the previous d efinition In file included from Socket.hsc:22: include/HsNet.h:80:1: warning: "s6_addr32" redefined In file included from include/HsNet.h:77, from Socket.hsc:22: /usr/include/netinet/in.h:203:1: warning: this is the location of the previous d efinition Socket.hsc: In function ‘main’: Socket.hsc:431: error: ‘struct in6_addr’ has no member named ‘__u6_addr’ Socket.hsc:432: error: ‘struct in6_addr’ has no member named ‘__u6_addr’ Socket.hsc:433: error: ‘struct in6_addr’ has no member named ‘__u6_addr’ Socket.hsc:434: error: ‘struct in6_addr’ has no member named ‘__u6_addr’ Socket.hsc:438: error: ‘struct in6_addr’ has no member named ‘__u6_addr’ Socket.hsc:439: error: ‘struct in6_addr’ has no member named ‘__u6_addr’ Socket.hsc:440: error: ‘struct in6_addr’ has no member named ‘__u6_addr’ Socket.hsc:441: error: ‘struct in6_addr’ has no member named ‘__u6_addr’ compiling dist/build/Network/Socket_hsc_make.c failed command was: gcc -c -D__GLASGOW_HASKELL__=607 -I/home/ian/ghc/darcs/build2/inclu des -Iinclude -DCALLCONV=ccall dist/build/Network/Socket_hsc_make.c -o dist/buil d/Network/Socket_hsc_make.o make: *** [network/GNUmakefile] Error 1 Thanks Ian

Uh. It might be that the autoconf check doesn't work, or is implementod the wrong way. What is the output of configure? Anyways, I think the safest approach would be to just check for darwin. But I couldn't find out how to do that in a portable and reliable way. Ideas? / Thomas On 27 jun 2007, at 13.25, Ian Lynagh wrote:
On Sat, Jun 23, 2007 at 03:12:38PM -0700, Thomas Schilling wrote:
Fri Jun 22 18:58:52 CEST 2007 Thomas Schilling
* s6_addr32 is undefined on darwin. Added an AC check and a definition taken from the NetBSD sources. This breaks the build on Debian amd64 Linux:
ifBuildable/ifBuildable network setup/Setup makefile -f GNUmakefile Reading parameters from /home/ian/ghc/darcs/build2/libraries/ network/network.bui ldinfo Preprocessing library network-2.0.1... In file included from BSD.hsc:17: include/HsNet.h:80:1: warning: "s6_addr32" redefined In file included from include/HsNet.h:77, from BSD.hsc:17: /usr/include/netinet/in.h:203:1: warning: this is the location of the previous d efinition In file included from Socket.hsc:22: include/HsNet.h:80:1: warning: "s6_addr32" redefined In file included from include/HsNet.h:77, from Socket.hsc:22: /usr/include/netinet/in.h:203:1: warning: this is the location of the previous d efinition Socket.hsc: In function ‘main’: Socket.hsc:431: error: ‘struct in6_addr’ has no member named ‘__u6_addr’ Socket.hsc:432: error: ‘struct in6_addr’ has no member named ‘__u6_addr’ Socket.hsc:433: error: ‘struct in6_addr’ has no member named ‘__u6_addr’ Socket.hsc:434: error: ‘struct in6_addr’ has no member named ‘__u6_addr’ Socket.hsc:438: error: ‘struct in6_addr’ has no member named ‘__u6_addr’ Socket.hsc:439: error: ‘struct in6_addr’ has no member named ‘__u6_addr’ Socket.hsc:440: error: ‘struct in6_addr’ has no member named ‘__u6_addr’ Socket.hsc:441: error: ‘struct in6_addr’ has no member named ‘__u6_addr’ compiling dist/build/Network/Socket_hsc_make.c failed command was: gcc -c -D__GLASGOW_HASKELL__=607 -I/home/ian/ghc/darcs/ build2/inclu des -Iinclude -DCALLCONV=ccall dist/build/Network/Socket_hsc_make.c -o dist/buil d/Network/Socket_hsc_make.o make: *** [network/GNUmakefile] Error 1
Thanks Ian

On Wed, Jun 27, 2007 at 01:43:30PM +0200, Thomas Schilling wrote:
Uh. It might be that the autoconf check doesn't work, or is implementod the wrong way. What is the output of configure?
[...] checking for in_addr_t in netinet/in.h... yes checking for s6_addr32 in netinet6/in6.h... no checking for getaddrinfo... yes [...] I have no netinet6 directory, and all my in6.h's are in linux directories. It looks like my netinet/in.h does define s6_addr32, but that doesn't mean that's portable of course. Thanks Ian

On 27 jun 2007, at 13.50, Ian Lynagh wrote:
On Wed, Jun 27, 2007 at 01:43:30PM +0200, Thomas Schilling wrote:
Uh. It might be that the autoconf check doesn't work, or is implementod the wrong way. What is the output of configure?
[...] checking for in_addr_t in netinet/in.h... yes checking for s6_addr32 in netinet6/in6.h... no checking for getaddrinfo... yes [...]
I have no netinet6 directory, and all my in6.h's are in linux directories. It looks like my netinet/in.h does define s6_addr32, but that doesn't mean that's portable of course.
Ok, so there's the quick'n'dirty and the clean[tm] fix. - quick'n'dirty: Also grep for s6_addr32 in netinet/in.h . A possibly cleaner way is to use: AC_CHECK_DECL(s6_addr32) I'm a complete autoconf newbie, so this it what seems most appropriate, according to the list at http://www.gnu.org/software/autoconf/manual/autoconf-2.57/ html_chapter/autoconf_3.html#SEC9 - clean: remove the use of s6_addr32 in the sources and use the portable s6_addr, as discussed earlier on this list. / Thomas

Ian Lynagh wrote:
This breaks the build on Debian amd64 Linux:
Here's a patch that should be more portable. It gets rid of all mention of s6_addr32, fixes a broken autoconf test, and adds some more AI_* flags that are required for correct functioning on some platforms (e.g. recent Linux/glibc). Please give it a try, and let me know how it works for you.

Bryan O'Sullivan wrote:
Here's a patch that should be more portable. It gets rid of all mention of s6_addr32, fixes a broken autoconf test, and adds some more AI_* flags that are required for correct functioning on some platforms (e.g. recent Linux/glibc).
I've had a chance to test it out on OS X. It required a little more tweaking, but now works nicely. The same code also works on Fedora 7 and Debian Etch. You can get the results here: darcs get --partial http://darcs.serpentine.com/network

On Wed, Jun 27, 2007 at 02:44:00PM -0700, Bryan O'Sullivan wrote:
darcs get --partial http://darcs.serpentine.com/network
Patches pushed; thanks! Ian

Ian Lynagh wrote:
darcs get --partial http://darcs.serpentine.com/network
Patches pushed;
Thank you!
participants (3)
-
Bryan O'Sullivan
-
Ian Lynagh
-
Thomas Schilling