Removing -pthread from gcc

Daniel Eischen eischen at vigrid.com
Thu Aug 28 22:28:20 PDT 2003


On Fri, 29 Aug 2003, [iso-8859-1] Pedro F. Giffuni wrote:

> Hi guys;
> 
> First of all congratulations to all the people involved in the new thread
> support!
> 
> I'm not understanding what the new world order will be, but please try to agree
> something with the autoconf people: from my porting experience, autoconf is not
> interested on what PTHREAD_LIBS says; it just tries to link with pthread and if
> that fails it assumes the platform doesn't support threads at all.

-pthread is currently a compiler switch, and we (FreeBSD) are
one of the very few OSes that have such an option.  It was only
there to prevent linking to libc in FreeBSD-[34]; otherwise
it would not exist.  Do not confuse -pthread with -lpthread
or -lthr/-lkse/-llinuxthreads/-lwhatever.  If autoconf has
been taught that FreeBSD has -pthread, then it will have to
be untaught.

Eliminating -pthread will expose those ports that use it
and then they can be fixed.  If left in and we try to link
with libpthread,libkse,libthr, etc, we will end up with
ports that link to one of those libraries _and_ libc_r.
Just try copying libkse or libthr to libpthread _without_
changing PTHREAD_LIBS (so you still use libc_r) and
rebuilding X or KDE.  Those ports will end up detecting
libpthread and linking to it, and they will still also
link to libc_r.  This will not work but you won't know it
until you try running the port and wacky weirdness ensues.

-- 
Dan Eischen



More information about the freebsd-threads mailing list