<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>


<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">

<p class="details" style="font-style: italic; color: #777;">
<a href="https://gitlab.com/jejb">James Bottomley</a> created an issue <a href="https://gitlab.com/gnutls/gnutls/-/issues/1044">#1044</a>:
</p>
<div></div>
<p dir="auto">`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.</p>
<p dir="auto">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</p>
<p dir="auto">Signed-off-by: James Bottomley <a href="mailto:James.Bottomley@HansenPartnership.com">James.Bottomley@HansenPartnership.com</a></p>
<hr>
<p dir="auto">diff --git a/lib/Makefile.am b/lib/Makefile.am
index f55f298f7b..cee7906765 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -168,7 +168,7 @@ libgnutls_la_LIBADD += accelerated/libaccelerated.la
endif</p>
<p dir="auto">if !WINDOWS
-thirdparty_libadd += $(LTLIBPTHREAD)
+thirdparty_libadd += $(LIBPTHREAD)
endif</p>
<p dir="auto">if NEEDS_LIBRT<a href="https://gitlab.com/gnutls/gnutls/uploads/f9b3a3cae0774bfda19680f1ba38ecc6/tmp.txt" data-link="true" class="gfm">tmp.txt</a>`</p>

</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #777;">

<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/-/issues/1044">view it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can
<a href="https://gitlab.com/-/sent_notifications/afbb5613d8895991dcfe600245e2300f/unsubscribe">unsubscribe</a>
from this thread or
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.com/gnutls/gnutls/-/issues/1044"}}</script>


</p>
</div>
</body>
</html>