Should link explicitly with libpthread
1b08d58b started looking for pthread_mutex_lock()
in libc rather than libpthread. This is unfortunately a bit misguided. libc contains those functions, but only stubs. So the test will succeed, the program will link and will even run.
However! Once something else pulls in libpthread, then those stubs get replaced by the real thing. And calling pthread_mutex_lock()
with a mutex initialised by the stub will at best return an error, at worse crash or cause a security issue. Also, GnuTLS calls abort()
on such errors.
Things often work despite this issue as libpthread is pulled in on start by other libraries' dependencies. It fails if libpthread is pulled in after start, e.g. by a NSS module.