GNOME Bugzilla – Bug 377066
Build failure on GNU/Hurd
Last modified: 2006-11-20 16:58:13 UTC
Building gamin fails on GNU/Hurd: /bin/sh ../libtool --mode=compile --tag=CC cc -DHAVE_CONFIG_H -I. -I/build/buildd/gamin-0.1.7/./libgamin -I.. -I.. -I/build/buildd/gamin-0.1.7/./lib -DBINDIR=\""/usr/lib/gamin"\" -DBUILDDIR=\"".."\" -DGAM_DEBUG_ENABLED -Wall -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wsign-compare -Wno-sign-compare -g -c -o gam_data.lo /build/buildd/gamin-0.1.7/./libgamin/gam_data.c cc -DHAVE_CONFIG_H -I. -I/build/buildd/gamin-0.1.7/./libgamin -I.. -I.. -I/build/buildd/gamin-0.1.7/./lib -DBINDIR=\"/usr/lib/gamin\" -DBUILDDIR=\"..\" -DGAM_DEBUG_ENABLED -Wall -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wsign-compare -Wno-sign-compare -g -c /build/buildd/gamin-0.1.7/./libgamin/gam_data.c -fPIC -DPIC -o .libs/gam_data.o /build/buildd/gamin-0.1.7/./libgamin/gam_data.c:32:14: warning: extra tokens at end of #ifdef directive /build/buildd/gamin-0.1.7/./libgamin/gam_data.c: In function 'gamin_data_new': /build/buildd/gamin-0.1.7/./libgamin/gam_data.c:475: error: 'PTHREAD_MUTEX_RECURSIVE_NP' undeclared (first use in this function) /build/buildd/gamin-0.1.7/./libgamin/gam_data.c:475: error: (Each undeclared identifier is reported only once /build/buildd/gamin-0.1.7/./libgamin/gam_data.c:475: error: for each function it appears in.) make[3]: *** [gam_data.lo] Error 1 This is due to: #ifdef __GLIBC__ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); #else pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); #endif which is clearly wrong, as GNU/Hurd is glibc-based, but does not define PTHREAD_MUTEX_RECURSIVE_NP. In order to have PTHREAD_MUTEX_RECURSIVE available on GNU/Linux, at least __USE_UNIX98 needs to be defined, see <pthread.h>. Relying on some non-portable (_NP) macros looks wrong to me here, but maybe the check could be modified to first check for the availability of PTHREAD_MUTEX_RECURSIVE_NP and only use PTHREAD_MUTEX_RECURSIVE if it is not present.
Created attachment 76850 [details] [review] proposed patch
PTHREAD_MUTEX_RECURSIVE_NP being an enum value, that patch just doesn't compile on Linux. So I switched to #if defined(linux) || defined(PTHREAD_MUTEX_RECURSIVE_NP) I'm afraid it's not perfect but this should be better. Applied to CVS. thanks, Daniel