GNOME Bugzilla – Bug 645336
Solaris needs #include <sys/mkdev.h> and -lresolv -lnsl -lsocket in gio
Last modified: 2011-09-04 13:02:44 UTC
Two unrelated problems when building glib-2.26.1 from source on Solaris 5.9 for SPARC: -------------------------------------------------------- libgio compilation fails with two undefined symbols: major minor Adding #include <sys/mkdev.h> to gio/gdbusmessage.c solves this issue -------------------------------------------------------- gio/tests fail with: /bin/bash ../../libtool --tag=CC --mode=link /usr/local/bin/gcc -mcpu=v9 -Wall -L/home/admini/saper/lib -o socket socket.o ../../glib/libglib-2.0.la ../../gthread/libgthread-2.0.la ../../gobject/libgobject-2.0.la ../../gio/libgio-2.0.la libtool: link: /usr/local/bin/gcc -mcpu=v9 -Wall -o .libs/socket socket.o -L/home/admini/saper/lib ../../glib/.libs/libglib-2.0.so ../../gthread/.libs/libgthread-2.0.so ../../gobject/.libs/libgobject-2.0.so ../../gio/.libs/libgio-2.0.so /home/admini/saper/src/glib-2.26.1/gobject/.libs/libgobject-2.0.so /home/admini/saper/src/glib-2.26.1/gthread/.libs/libgthread-2.0.so -lpthread -lthread -lrt /home/admini/saper/src/glib-2.26.1/gmodule/.libs/libgmodule-2.0.so -ldl /home/admini/saper/src/glib-2.26.1/glib/.libs/libglib-2.0.so /home/admini/saper/lib/libiconv.so /home/admini/saper/lib/libpcre.so -lresolv -lz -R/home/admini/saper/lib ld: warning: file /home/admini/saper/src/glib-2.26.1/gobject/.libs/libgobject-2.0.so: linked to ../../gobject/.libs/libgobject-2.0.so: attempted multiple inclusion of file ld: warning: file /home/admini/saper/src/glib-2.26.1/gthread/.libs/libgthread-2.0.so: linked to ../../gthread/.libs/libgthread-2.0.so: attempted multiple inclusion of file ld: warning: file /home/admini/saper/src/glib-2.26.1/glib/.libs/libglib-2.0.so: linked to ../../glib/.libs/libglib-2.0.so: attempted multiple inclusion of file Undefined first referenced symbol in file socket socket.o (symbol belongs to implicit dependency /usr/lib/libsocket.so.1) ld: fatal: Symbol referencing errors. No output written to .libs/socket collect2: ld returned 1 exit status *** Error code 1 make: Fatal error: Command failed for target `socket' Changing empty "LIBS = " to "LIBS = -lresolv -lsocket -lnsl" in gio/tests/Makefile fixes the problem Configure invocation: env CFLAGS="-mcpu=v9" PCRE_CFLAGS="-I$HOME/include" PCRE_LIBS="-L$HOME /lib -lpcre" ./configure --prefix=$HOME --disable-fam --enable-static --disable-gtk-doc --disable-man --without-xml-catalog --disable-dtrace --with-pcre=system --with-libiconv=gnu
the sys/mkdev part was fixed as bug 637013, which didn't mention anything about -lsocket, etc. is that still needed? If so, can you provide a configure.ac patch?
The problem with -lsocket is unrelated to the mkdev.h problem. This is because gio/tests/Makefile does not somehow have means to guess additional socket libraries, so it's only in tests. There is a check for -lresolv already present in configure.ac (for gio/libasyncns) but my autoconf foo is too limited to come up with something reasonable. Testing for those 3 libraries to use sockets and name resolution on Solaris is pretty common and there should be some macros to do that.
fixed in master
Created attachment 195610 [details] config.log from failed mingw32 ./configure commit 0d637931299f254e1b9a2cdb2d4e050b157ec8d9 breaks the build on mingw32: ... checking arpa/nameser_compat.h presence... no checking for arpa/nameser_compat.h... no checking for strndup... no checking for setresuid... no checking for setreuid... no checking sys/prctl.h usability... no checking sys/prctl.h presence... no checking for sys/prctl.h... no checking for res_query... configure: error: not found
Created attachment 195611 [details] config.log from failed mingw32 ./configure wrong config.log, sorry. this is the correct one.
fixed