GNOME Bugzilla – Bug 110859
gnet 2.0.0 doesn't build on Solaris 7
Last modified: 2009-08-15 18:40:50 UTC
% uname -a SunOS osserver1 5.7 Generic_106541-23 sun4u sparc SUNW,Ultra-60 make all-recursive make[1]: Entering directory `/users/ckerr/src/new/gnet-2.0.0' Making all in src make[2]: Entering directory `/users/ckerr/src/new/gnet-2.0.0/src' /usr/local/bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -DG_LOG_DOMAIN=\"GNet\" -I/users/ckerr/gnome2/include/glib-2.0 -I/users/ckerr/gnome2/lib/glib-2.0/include -pthreads -I/users/ckerr/gnome2/include/glib-2.0 -I/users/ckerr/gnome2/lib/glib-2.0/include -I/users/ckerr/gnome2/include -I/users/ckerr/include -I/users/opup/devtools/include -I/users/opup/new_build/build/third_party/X11R6_headers/ -I/users/ckerr/include -g -Wall -D_REENTRANT -DGNET_EXPERIMENTAL -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -c gnet.c mkdir .libs gcc -DHAVE_CONFIG_H -I. -I. -I.. -DG_LOG_DOMAIN=\"GNet\" -I/users/ckerr/gnome2/include/glib-2.0 -I/users/ckerr/gnome2/lib/glib-2.0/include -pthreads -I/users/ckerr/gnome2/include/glib-2.0 -I/users/ckerr/gnome2/lib/glib-2.0/include -I/users/ckerr/gnome2/include -I/users/ckerr/include -I/users/opup/devtools/include -I/users/opup/new_build/build/third_party/X11R6_headers/ -I/users/ckerr/include -g -Wall -D_REENTRANT -DGNET_EXPERIMENTAL -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -c gnet.c -fPIC -DPIC -o .libs/gnet.lo In file included from gnet.c:21: gnet-private.h:174: field `sa' has incomplete type gnet-private.h:182: field `sa' has incomplete type gnet-private.h:190: field `sa' has incomplete type gnet-private.h:212: field `sa' has incomplete type gnet.c: In function `ipv6_detect_envvar': gnet.c:85: warning: implicit declaration of function `index' gnet.c:85: warning: assignment makes pointer from integer without a cast gnet.c:86: warning: assignment makes pointer from integer without a cast make[2]: *** [gnet.lo] Error 1 make[2]: Leaving directory `/users/ckerr/src/new/gnet-2.0.0/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/users/ckerr/src/new/gnet-2.0.0' make: *** [all-recursive-am] Error 2 3 warnings
Created attachment 15741 [details] config.log
There seems to be two problems: 1.struct sockaddr_storage isn't defined in gnet-private.h. Is this in a different header file on Solaris? 2. strchr() should be used instead of index() in gnet.c. I will fix this.
Looks like, after a little Googling, that Solaris 6 & 7 don't define sockaddr_storage at all. PHP has worked around this in its configure.in, by checking for the structure and, if it's not present, defining it itself. The attached files are from php 4.3.1, which might be a useful template: configure.in has tests for sockaddr_storage and sockaddr_len, and php_network.h uses these #defines to build the struct when necessary.
Created attachment 15745 [details] php 4.3.1's configure.in
Created attachment 15746 [details] php 4.3.1's php_network.h
Ok, I've committed the change to CVS. Could you try it out? Thanks.
Since GNet uses "struct sockaddr_storage" everywhere, the declaration needs to be: Index: gnet-private.h =================================================================== RCS file: /cvs/gnome/gnet/src/gnet-private.h,v retrieving revision 1.43 diff -u -u -r1.43 gnet-private.h --- gnet-private.h 15 Apr 2003 17:38:48 -0000 1.43 +++ gnet-private.h 15 Apr 2003 18:14:35 -0000 @@ -71,7 +71,7 @@ #include <netdb.h> #ifndef HAVE_SOCKADDR_STORAGE -typedef struct { +struct sockaddr_storage { #ifdef HAVE_SOCKADDR_LEN unsigned char ss_len; unsigned char ss_family; @@ -79,7 +79,7 @@ unsigned short ss_family; #endif char info[126]; -} sockaddr_storage; +}; #endif This gets us a little further, dying at gnet-private: gnet-private.c: In function `gnet_private_create_listen_socket': gnet-private.c:44: dereferencing pointer to incomplete type gnet-private.c:67: `AF_INET6' undeclared (first use in this function) gnet-private.c:67: (Each undeclared identifier is reported only once gnet-private.c:67: for each function it appears in.) gnet-private.c:70: dereferencing pointer to incomplete type gnet-private.c:72: dereferencing pointer to incomplete type gnet-private.c:72: dereferencing pointer to incomplete type gnet-private.c:73: dereferencing pointer to incomplete type make: *** [gnet-private.lo] Error 1
Ok, try CVS again. Or this snapshot: www.gizmolabs.org/~dhelder/gnet030416.tar.gz This now defines a HAVE_IPV6 in config.h.
With a couple of small caveats, gnet030416.tar.gz does the trick: (1) a lot of warnings about gcc: unrecognize option `-pthread'. However, everything built fine, so mayb e this is a problem on my end. (2) unit test failures: set_bytes addr6: FAIL new_bytes length6: FAIL get_bytes addr: FAIL !IPv4 (inetaddr new): FAIL (process:28407): GNet-CRITICAL **: file inetaddr.c: line 2230 (gnet_inetaddr_get_canonical_name): assertion `inetaddr != NULL' failed !IPv4 (get cname): FAIL FAIL: inetaddr_test PASS: ipv6_test PASS: pack_test PASS: unpack_test PASS: uri_test =================== 1 of 7 tests failed ===================
Great! This snapshot might fix the pthread warning and should fix the testcase: http://www.gnetlibrary.org/snapshot/gnet030418.tar.gz
This should now be fixed in 2.0.1.