libgpgme.so problem when linked to libpthread

Marcus Brinkmann marcus.brinkmann at ruhr-uni-bochum.de
Mon Jul 11 15:07:43 CEST 2005


At Mon, 4 Jul 2005 15:09:54 +0100,
Rui Paulo <rpaulo at NetBSD.org> wrote:
> While investigating a supposed pthread problem under NetBSD with the
> help of Nathan Williams, he noticed that our pkg infrastructure, pkgsrc,
> is linking libgpgme.so with libpthread.so, event that should only
> happen with libgpgme-pthread.so.
> 
> This causes the problem described under PR#30414 [1].
> 
> I'm new to gpgme code, but seems like if libgpgme.so isn't linked with
> pthread (which should be the correct way), ath_* calls get translated to
> no-ops or to their libc counterpart (recvmsg, sendmsg, etc).
> While there is a problem with pkgsrc, I would like to know your opinion
> about this problem, as it may happen under other systems or package
> infrastructures.

There are two sides to this issue.  The correct way is to link against
gpgme-pthread if you are using pthread, and against gpgme, if you are
not.  Assuming that you don't link libgpgme against pthread, this
should fix all the problems you see.

The other issue is why it fails in the way it does, and this is more
complicated.  There is some backwards-compatibility support in GPGME,
which allows pthread-using programs to just link against libgpgme, and
it should work.  This is done with weak symbols.

However, this requires that you get the linking order right, and
probably some other things.  I have another report that it breaks on
GNU/Hurd, so maybe it only works on GNU/Linux.

If you check the GPGME NEWS file, you will see that this legacy
support is obsoleted and deprecated, and will be removed.  I could do
this in the next release.  However, this would not help much: You
would use a non-thread safe GPGME in a threaded application, calling
for even more subtle and difficult to understand bugs than the one you
were seeing.

I hope this information helps you.  I don't know what pkgsrc does to
get libgpgme linked with pthread.  This is definitely bogus.  It is
correct that only libgpgme-pthread should be directly linked with
pthread.

Thanks,
Marcus




More information about the Gnupg-devel mailing list