Subject: Re: Threading problems
To: Johnny Lam <>
From: Nathan J. Williams <>
List: tech-pkg
Date: 03/23/2005 11:33:49
Johnny Lam <> writes:

> Martin Husemann wrote:
> > On Wed, Mar 23, 2005 at 10:34:34AM -0500, Greg Troxel wrote:
> >
> >> as you hint, add a rule that every program in pkgsrc that can
> >> possibly dlopen anything be linked with pthreads.
> > This has happened a long time ago, hasn't it?
> What pkgsrc actually does is "every program in pkgsrc that can
> possibly use dlopen() (either directly or indirectly) is linked with
> pthreads *on NetBSD>=2.0 and NetBSD<=2.99.10*.  I believe that
> NetBSD's native libpthread and libc were modified in subsequent
> versions to not require this.

It is still necessary to have the app link in libpthread if a library
is linked against libpthread; what was changed in 2.99.10 or
thereabouts was that it became possible for libraries that want to use
threading primatives (mutexes and condvars) defensively to not need to
be linked against libpthread in the first place. (This replaced the
somewhat clunkier threadlib.h mechanism, which required modifying the
library code to use those interfaces instead of the normal pthread

I haven't yet gone on a rampage through pkgsrc looking for libraries
that are (now) unnecessairly linked against libpthread; I know they're
there (graphics/gd is one example), and I fear that there are a lot of
them, because for a long time linking in libpthread was the only way
to make them build.

        - Nathan