-nodefaultlibs and pthreads

Peter S. Mazinger ps.m at gmx.net
Mon Jul 10 08:55:25 UTC 2006


On Fri, 7 Jul 2006, Michael Hunold wrote:

> Hello Rich,
> 
> sorry for the long response time.
> 
> on 30.06.2006 16:22 Rich Felker said the following:
> > On Fri, Jun 30, 2006 at 10:58:57AM +0200, Michael Hunold wrote:
> >> When I use "-nodefaultlibs -lc -lpthread", however, things are different.
> >>
> >> /opt/uclibc/bin/mips-linux-uclibc-gcc -Wall timedlock.c -o timedlock
> >> -nodefaultlibs -lc -lpthread
> > 
> > Yes, you're linking the libs in the wrong order. Put -lpthread -lc and
> > everything will be fine.
> 
> Thank you very much, that's it.
> 
> I'm wondering why this is possible at all, though.
> 
> If I specify the libraries in the wrong order, then some stub or
> replacement functions from glibc are used instead the ones I want from
> libpthread, right?

The older implementation of cancellable functions is done non-cancellable 
in libc and cancellable in libpthread (implemented this way in glibc-2.2.x 
and uClibc), the newer glibc's have only one version of the function 
cancellable in libc, this way the order is revelant for uClibc and older 
glibc.

Peter
 
> But I need to specify -lpthread, otherwise the linking fails and I won't
> get an application at all.
> 
> The resulting application is completely unusable, so I really wonder
> what the rationale behind this is. Probably this is "like it is" due to
> historic reasons... 8-(
> 
> > Rich
> 
> CU
> Michael.
> 
> 

-- 
Peter S. Mazinger <ps dot m at gmx dot net>           ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2




More information about the uClibc mailing list