-nodefaultlibs and pthreads

Michael Hunold hunold at linuxtv.org
Fri Jul 7 06:11:55 PDT 2006


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?

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.


More information about the uClibc mailing list