After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 589989 - Compilation error on Solaris 9 (undefined reference to `CMSG_SPACE')
Compilation error on Solaris 9 (undefined reference to `CMSG_SPACE')
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
2.21.x
Other Solaris
: Normal critical
: ---
Assigned To: gtkdev
gtkdev
: 610664 616332 639252 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-07-28 10:17 UTC by Artur Frysiak
Modified: 2011-01-12 00:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Define CMSG_ALIGN/CMSG_SPACE/CMSG_LEN if not available (622 bytes, patch)
2009-07-31 08:48 UTC, Artur Frysiak
none Details | Review
possible improved patch (854 bytes, patch)
2009-12-18 03:25 UTC, Tim Rice
none Details | Review
GSocket: define CMSG_LEN and CMSG_SPACE if the system doesn't (1.07 KB, patch)
2010-02-25 16:44 UTC, Dan Winship
committed Details | Review

Description Artur Frysiak 2009-07-28 10:17:53 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.
Comment 2 Dan Winship 2009-07-30 15:27:23 UTC
can you submit a patch? none of us have solaris 9 boxes we can test against
Comment 3 Artur Frysiak 2009-07-31 08:48:53 UTC
Created attachment 139612 [details] [review]
Define CMSG_ALIGN/CMSG_SPACE/CMSG_LEN if not available

Based on VLC
Comment 4 Artur Frysiak 2009-08-03 16:35:07 UTC
Patch submitted.
Comment 5 Matthias Clasen 2009-08-07 02:52:15 UTC
Lennart, what is the best way to send libasyncns patches ?
Comment 6 Lennart Poettering 2009-08-07 13:05:33 UTC
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.
Comment 7 Dan Winship 2009-08-24 14:51:52 UTC
(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.
Comment 8 Tim Rice 2009-12-18 03:25:01 UTC
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.
Comment 9 Dan Winship 2010-02-22 14:20:22 UTC
*** Bug 610664 has been marked as a duplicate of this bug. ***
Comment 10 Dan Winship 2010-02-25 16:44:07 UTC
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.
Comment 11 Tim Rice 2010-03-10 19:47:56 UTC
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)
Comment 12 Dan Winship 2010-04-20 21:09:27 UTC
*** Bug 616332 has been marked as a duplicate of this bug. ***
Comment 13 Dan Winship 2010-04-23 16:40:23 UTC
Attachment 154703 [details] pushed as 1504a77 - GSocket: define CMSG_LEN and CMSG_SPACE if the system doesn't
Comment 14 Dan Winship 2011-01-12 00:07:43 UTC
*** Bug 639252 has been marked as a duplicate of this bug. ***