Re: [Fwd: ORBit2 HEAD broken on Linux] - gthread problem



Hi

> 	Is this a feature ?

Yes. See Bug #77981

-pthread is the canonical way for gcc on almost all platforms (and for
some other compilers too) to compile and link threaded applications.

> From: Laszlo PETER <Laszlo Peter ireland sun com>
> To: Michael Meeks <michael ximian com>
> Subject: ORBit2 HEAD broken on Linux
> Date: 07 Jul 2002 12:45:36 +0100
> 
> Hi Michael,
> 
> There was a change in gthread whereby the -lpthread flag was
> replaced with -pthread on Linux.  This caused 2 problems with
> ORBit2: 
> 
>   - pkg-config has a bug (85244) where it only merges the
>     -l... and -L... flags from the requirement libs
>     so the -pthread flag will be missing.
>     This can be worked around by explicitely listing gthread-2.0
>     in PKG_CHECK_MODULES.

This should be fixed in pkg-config.

>   - libtool won't pick up -pthread from the .la files either, so
>     I had to add $(ORBIT_LIBS) to the LDADD of the test programs.

This is (for sure) more controversial. But I would argue, that this is
the right behavior. If you e.g. link a library with -lpthread, then ldd
on that library will show libpthread. If however you link with -pthread,
you will not get that. This (seems) to be a feature of gcc to special
case the thread library, which should not be linked into an application,
if the application does not explicitly ask for it, because linking to
libpthread is associated with quite an overhead.

There are other problems with that change too, see #77981. The short
version is, that linking in automake includes CFLAGS, so simply adding
pkg-config --cflags gthread-2.0 to CFLAGS will produce multithreaded
programs. Instead you have to add it to INCLUDES in every Makefile.am.

All in all, this change wont be committed to glib-2-0, so there should
be enough time to cope with it for glib-2.2. Indeed for some platforms
(AIX) it already is that way (i.e using -pthread) for glib-2-0, so this
change unifies the behavior a bit.

Bye,
Sebastian
-- 
Sebastian Wilhelmi
mailto:wilhelmi ira uka de
http://goethe.ira.uka.de/~wilhelmi





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]