Created attachment 104620 [details] Fix build against older pthreads implementations Older pthreads implementations like glibc NPTL prior to version 2.12, and uClibc linuxthreads (both), need _XOPEN_SOURCE to expose pthread_mutexattr_settype() and THREAD_MUTEX_DEFAULT. This results in the following build error: CC compat.lo compat.c: In function 'p11_mutex_init': compat.c:164:2: warning: implicit declaration of function 'pthread_mutexattr_settype' [-Wimplicit-function-declaration] compat.c:164:2: warning: nested extern declaration of 'pthread_mutexattr_settype' [-Wnested-externs] compat.c:164:36: error: 'PTHREAD_MUTEX_DEFAULT' undeclared (first use in this function) The attached patch should fix this.
I'm a bit worried about defining this in a header. Would it work to define it very early in the compat.c file?
(In reply to comment #1) > I'm a bit worried about defining this in a header. Would it work to define > it very early in the compat.c file? This can only work if you define _XOPEN_SOURCE before '#include "compat.h"'. Is that what you mean?
(In reply to comment #2) > (In reply to comment #1) > > I'm a bit worried about defining this in a header. Would it work to define > > it very early in the compat.c file? > > This can only work if you define _XOPEN_SOURCE before '#include "compat.h"'. > Is that what you mean? Yes.
Created attachment 104621 [details] [review] Fix build against older pthreads implementations (revised) Here is a revised patch, build tested.
Thanks. Merged the patch into master.
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.