GNOME Bugzilla – Bug 589989
Compilation error on Solaris 9 (undefined reference to `CMSG_SPACE')
Last modified: 2011-01-12 00:07:43 UTC
Steps to reproduce: 1. install OpenPKG on Solaris 9 2. get and unpack glib 2.21.4 2. remove #include <stdint.h> from gio/libasyncns/g-asyncns.h (see Bug #589988) 2. try to build Stack trace: /bin/bash ../../libtool --tag=CC --mode=link /openpkg/bin/cc -O2 -pipe -Wall -L/openpkg/lib -o resolver resolver.o ../../glib/libglib2.la ../../gobject/libgobject2.la ../../gio/libgio2.la ../../gthread/libgthread2.la -lintl -liconv libtool: link: /openpkg/bin/cc -O2 -pipe -Wall -o resolver resolver.o -L/openpkg/lib ../../glib/.libs/libglib2.a ../../gobject/.libs/libgobject2.a ../../gio/.libs/libgio2.a /openpkg/RPM/TMP/glib-2.21.4/gobject/.libs/libgobject2.a /openpkg/RPM/TMP/glib-2.21.4/gmodule/.libs/libgmodule2.a -lresolv ../../gthread/.libs/libgthread2.a -lpthread -lthread -lrt /openpkg/RPM/TMP/glib-2.21.4/glib/.libs/libglib2.a /openpkg/lib/libpcre.a /openpkg/lib/libintl.a -lc -liconv /bin/bash ../../libtool --tag=CC --mode=link /openpkg/bin/cc -O2 -pipe -Wall -L/openpkg/lib -o socket-server socket-server.o ../../glib/libglib2.la ../../gobject/libgobject2.la ../../gio/libgio2.la ../../gthread/libgthread2.la -lintl -liconv libtool: link: /openpkg/bin/cc -O2 -pipe -Wall -o socket-server socket-server.o -L/openpkg/lib ../../glib/.libs/libglib2.a ../../gobject/.libs/libgobject2.a ../../gio/.libs/libgio2.a /openpkg/RPM/TMP/glib-2.21.4/gobject/.libs/libgobject2.a /openpkg/RPM/TMP/glib-2.21.4/gmodule/.libs/libgmodule2.a -lresolv ../../gthread/.libs/libgthread2.a -lpthread -lthread -lrt /openpkg/RPM/TMP/glib-2.21.4/glib/.libs/libglib2.a /openpkg/lib/libpcre.a /openpkg/lib/libintl.a -lc -liconv ../../gio/.libs/libgio2.a(gsocket.o): In function `g_socket_send_message': gsocket.c:(.text+0x718): undefined reference to `CMSG_SPACE' gsocket.c:(.text+0x788): undefined reference to `CMSG_LEN' collect2: ld returned 1 exit status make[4]: *** [socket-server] Error 1 make[4]: Leaving directory `/openpkg/RPM/TMP/glib-2.21.4/gio/tests' Other information: No CMSG_SPACE and CMSG_LEN macros on Solaris 9.
Please look at http://mailman.videolan.org/pipermail/vlc-devel/2006-May/024400.html and http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9dd13ebf18681e4ff58af0b52325d12aa1c23d90 This look very similar.
can you submit a patch? none of us have solaris 9 boxes we can test against
Created attachment 139612 [details] [review] Define CMSG_ALIGN/CMSG_SPACE/CMSG_LEN if not available Based on VLC
Patch submitted.
Lennart, what is the best way to send libasyncns patches ?
Either send them to me personally, or -- if you are lazy -- just commit them to glib git and I'll steal them from there eventually when I update libasyncns again.
(In reply to comment #5) > Lennart, what is the best way to send libasyncns patches ? (This isn't actually libasyncns-related, it's GSocket.) (In reply to comment #3) > Created an attachment (id=139612) [details] > Define CMSG_ALIGN/CMSG_SPACE/CMSG_LEN if not available > > Based on VLC This patch seems wrong to me, in that there's no obvious reason why it should be referring to intptr_t; presumably this was just copied from Solaris 10 and may not actually be correct on other non-CMSG_SPACE/CMSG_LEN-defining platforms? In particular, if CMSG_SPACE doesn't guarantee that it provides at least as much padding as CMSG_NXTHDR is expecting, then we will run out of room in msg.msg_control before serializing all of the options.
Created attachment 149964 [details] [review] possible improved patch >This patch seems wrong to me, in that there's no obvious reason why it should >be referring to intptr_t; presumably this was just copied from Solaris 10 and >may not actually be correct on other non-CMSG_SPACE/CMSG_LEN-defining >platforms? I have the same problem on UnixWare. It should probably be socklen_t instead of intptr_t. struct cmsghdr { socklen_t cmsg_len; /* data byte count, including hdr */ ^^^^^^^^^^^^^^^^^^ int cmsg_level; /* originating protocol */ int cmsg_type; /* protocol-specific type */ }; The cmsghdr struct is identical on UnixWare and Solaris 10.
*** Bug 610664 has been marked as a duplicate of this bug. ***
Created attachment 154703 [details] [review] GSocket: define CMSG_LEN and CMSG_SPACE if the system doesn't OK, after reading the definitions (and examing the pretty ASCII art) in RFC 2292, it seems that CMSG_LEN can reliably be defined in terms of CMSG_DATA, but CMSG_SPACE is technically impossible to define on your own without examining the behavior of CMSG_NXTHDR. However, there's an upper bound on the amount of padding the system might *reasonably* add, and we don't need to guess the exact right amount, so we're probably ok there.
I tested attachment id=154703 on UnixWare 7.1.4 and Solaris 8 using 2.23.5 If I add the missing #endif the patch works. I would expect if it works on Solaris 8 it will also work on Solaris 9 (the original reporter's system)
*** Bug 616332 has been marked as a duplicate of this bug. ***
Attachment 154703 [details] pushed as 1504a77 - GSocket: define CMSG_LEN and CMSG_SPACE if the system doesn't
*** Bug 639252 has been marked as a duplicate of this bug. ***