Skip to content
  • James Bottomley's avatar
    build: use $(LIBPTHREAD) rather than non-existent $(LTLIBPTHREAD) · f15c02b1
    James Bottomley authored and Daiki Ueno's avatar Daiki Ueno committed
    
    
    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: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
    f15c02b1