more about pthread (was Re: [uClibc] undefined reference while linking with libpthread.a)

Andrea Scian andrea.scian at wawnet.biz
Thu Sep 11 12:56:55 UTC 2003


After a bit of looking around I've found what was the problem... I was
simply linking with the wrong library version, I've adjust LDFLAGS and
everything links fine! my own fault, sorry! :-)

Now I've found another problem... "under the hood" Kaffe calls 2 different
pthread function when a thread need to wait on some condition (like monitor,
semaphore and things like this):
- pthread_cond_wait (when waiting for an infinite timeout)
- pthread_timedcond_wait (when waiting with finite timeout)

when the JVM calls pthread_cond_wait everything works fine but when it calls
pthread_timedcond_wait it fails, sometimes giving me an illegal instruction
error (SIGILL) sometimes telling me that there was an obsolete syscall (I'm
running under uClinux kernel 2.4.19).
While trying to resolve this problem I've found (inside pthread source) that
both pthread_cond_wait & pthread_timedcond_wait call different functions
based on the definition of the __NR_rt_sigaction symbol...
Looking for that symbol I've found that (at least on my source files) inside
restart.h & pthread.c there're this 3 lines of code:

#ifdef arm
#undef __NR_rt_sigaction
#endif

Just to try I comment out this 3 lines (in both file, of course), replacing
them with:

#define __NR_rt_sigaction

rebuild the whole uClibc and now everything works! :-)

Can anyone of this mailing list explain me why there was that #undef? and
why do I need to comment out it to make that pthread function work?
Is it a bug of pthread library or my own fault configuring uClibc (or
uClinux)?
Does anyone had problems like this using pthread with arm?

----- Original Message -----
From: "Erik Andersen" <andersen at codepoet.org>
To: "Andrea Scian" <andrea.scian at wawnet.biz>
Cc: "uClibc Mailing List" <uclibc at uclibc.org>
Sent: Thursday, September 11, 2003 1:01 PM
Subject: Re: [uClibc] undefined reference while linking with libpthread.a


> On Wed Sep 10, 2003 at 02:56:45PM +0200, Andrea Scian wrote:
> > Hi all!
> > While trying to compiling Kaffe JVM for ARM/uClinux with pthread support
I got a lot of undefined reference after adding -lpthread linking switch...
> > Here they are:
>
> I do not know what the problem is.  I think you may need to
> ask on the uclinux-dev mailing list, since all the people that
> maintain elf2flt can be found on that list.
>
>  -Erik
>
> --
> Erik B. Andersen             http://codepoet-consulting.com/
> --This message was written using 73% post-consumer electrons--
>




More information about the uClibc mailing list