Summary: | 0.8 does not build on kfreebsd-amd64 (implicit declaration of function pthread_mutexattr_settype) | ||
---|---|---|---|
Product: | p11-glue | Reporter: | Andreas Metzler <ametzler> |
Component: | p11-kit | Assignee: | Stef Walter <stefw> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | medium | CC: | ametzler, pankaj.cscience |
Version: | unspecified | ||
Hardware: | x86-64 (AMD64) | ||
OS: | other | ||
URL: | http://bugs.debian.org/647229 | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
Andreas Metzler
2011-11-01 01:17:18 UTC
pthreads are defined in POSIX: http://pubs.opengroup.org/onlinepubs/007904875/basedefs/pthread.h.html And are obviously present in FreeBSD: http://www.freebsd.org/cgi/man.cgi?query=pthread&apropos=0&sektion=0&manpath=FreeBSD+8.2-RELEASE&arch=default&format=html In addition both of the reported symbols (pthread_mutexattr_settype and PTHREAD_MUTEX_RECURSIVE) are both in POSIX and the FreeBSD headers, and are not GNU specific. I've also built on FreeBSD (and obviously linux), so it seems to me there must be something amiss with the kfreebsd-amd64 headers. Could you please examine the headers on your system and see if they're missing something? Stef Walter wrote: > pthreads are defined in POSIX: [...] > In addition both of the reported symbols (pthread_mutexattr_settype and > PTHREAD_MUTEX_RECURSIVE) are both in POSIX and the FreeBSD headers, and are not > GNU specific. Hello, while these symbols are defined in POSIX, afaict they are also marked as XSI extensions. As far as I understand the standard an application using XSI has to set _XOPEN_SOURCE accordingly.[1] http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap02.html#tag_02_02_04 Which seems to legitimize kFreeBSD behavior. p11-kit builds correctly with -D_XOPEN_SOURCE=600 or -D_XOPEN_SOURCE=500. Specifying _GNU_SOURCE also works. I really do not know which one is preferable. However gnulib's threadlib.m4 is using _GNU_SOURCE. It is also what gnustep-base (via AC_USE_SYSTEM_EXTENSIONS) and samhain chose to do when a similar bug appeared cu andreas [1] I am intentionally throwing in a great amounts of imhos, afaikss et al since I am no programmer. Thanks for doing the research. Could you prepare a patch to Makefile.am which adds -D_XOPEN_SOURCE=600 to INCLUDES? If you do it, then we can be sure that it's done in a way that fixes this build issue, since I don't have a kFreeBSD system running. But let me know if that's not possible. Stef Walter <stefw@collabora.co.uk> 2011-11-01 11:31:28 PDT --- > Andreas Metzler wrote: >> p11-kit builds correctly with -D_XOPEN_SOURCE=600 or -D_XOPEN_SOURCE=500 >> Thanks for doing the research. Could you prepare a patch to Makefile.am which >> adds -D_XOPEN_SOURCE=600 to INCLUDES? If you do it, then we can be sure that >> it's done in a way that fixes this build issue, since I don't have a kFreeBSD >> system running. Hello, Darn, looks like my test was broken, I ran it agaonst a patched copy of p11-kit with AC_USE_SYSTEM_EXTENSIONS. p11-kit does *not* build (even on linux) if only -D_XOPEN_SOURCE=600 is specified: -------------------- libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I.. -DP11_KIT_FUTURE_UNSTABLE_API -DP11_SYSTEM_CONFIG_FILE=\"/etc/pkcs11/pkcs11.conf\" -DP11_SYSTEM_CONFIG_MODULES=\"/etc/pkcs11/modules\" "-DP11_USER_CONFIG_FILE=\"~/.pkcs11/pkcs11.conf\"" "-DP11_USER_CONFIG_MODULES=\"~/.pkcs11/modules\"" -DP11_MODULE_PATH=\"/usr/lib/i386-linux-gnu/pkcs11\" -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE=600 -g -O2 -g -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wdeclaration-after-statement -Wformat=2 -Winit-self -Waggregate-return -Wno-missing-format-attribute -Wmissing-include-dirs -Wundef -c conf.c -fPIC -DPIC -o .libs/conf.o conf.c: In function 'load_configs_from_directory': conf.c:559:20: error: 'DT_UNKNOWN' undeclared (first use in this function) conf.c:559:20: note: each undeclared identifier is reported only once for each function it appears in conf.c:560:28: error: 'DT_DIR' undeclared (first use in this function) make[3]: *** [conf.lo] Error 1 -------------------- DT_UNKNOWN and DT_DIR require -D_BSD_SOURCE. (Explicitly specifying D_XOPEN_SOURCE=600 stops linux from enabling its default set of extensions.) To complicate things further the fact that kfreebsd-* requires specifiying extensions for pthread while it does not on linux has been tagged a bug (Scroll down near the end of http://bugs.debian.org/647823). Which leaves these options: * Do not change p11-kit upstream. It will continue to FTBFS on kfreebsd until the pthread header behavior is aligned with linux. Distributors will need to patch. * Use -D_XOPEN_SOURCE=600 -D_BSD_SOURCE on all archs * Use AC_USE_SYSTEM_EXTENSIONS. sorry for the delay in responding, cu andreas p11-kit 0.12 uses AC_USE_SYSTEM_EXTENSIONS, i.e. it is now using #define _GNU_SOURCE 1. I am therefore closing this report. cu andreas |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.