summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2020-06-28 21:33:09 +0200
committerDaiki Ueno <ueno@gnu.org>2020-08-31 08:13:45 +0200
commit9e55116c52422093343ec37a5349f693b7f84b73 (patch)
tree4cbc8ba85b30eea45adeb074ade8024688b412ad /lib
parent524b326ef5c9015145d000b48f405a104a0050cb (diff)
downloadgnutls-9e55116c52422093343ec37a5349f693b7f84b73.tar.gz
build: use $(LIBPTHREAD) rather than non-existent $(LTLIBPTHREAD)
On a very recent openSUSE build, libgnutls is getting built without libpthread. This caused a thread related error when trying to load a pkcs11 module that uses threading. The reason is rather convoluted: glibc actually controls all the pthread_ function calls, but it returns success without doing anything unless -lpthread is in the link list. What's happening is that gnutls_system_mutex_init() is being called on _gnutls_pkcs11_mutex before library pthreading is initialized, so the pthread_mutex_init ends up being a nop. Then, when the pkcs11 module is loaded, pthreads get initialized and the call to pthread_mutex_lock is real, but errors out on the uninitialized mutex. The problem seems to be that nothing in the gnulib macros gnutls relies on for threading support detection actually sets LTLIBPTHREAD, they only set LIBPTHREAD. The fix is to use LIBPTHREAD in lib/Makefile.in Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index fa47ac5e62..02504d8d10 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -168,7 +168,13 @@ libgnutls_la_LIBADD += accelerated/libaccelerated.la
endif
if !WINDOWS
-thirdparty_libadd += $(LTLIBPTHREAD)
+# p11-kit does not work without threading support:
+# https://github.com/p11-glue/p11-kit/pull/183
+if ENABLE_PKCS11
+thirdparty_libadd += $(LIBPMULTITHREAD)
+else
+thirdparty_libadd += $(LIBPTHREAD)
+endif
endif
if NEEDS_LIBRT