Society of Robots - Robot Forum

Software => Software => Topic started by: pomprocker on January 25, 2010, 04:28:16 PM

Title: POSIX Threads
Post by: pomprocker on January 25, 2010, 04:28:16 PM
Do any of you C experts have any experience with pthreads or GNU pth??

I'm trying to cross compile and voice control program 'cvoicecontrol' on a linux ppc type machine...
Title: Re: POSIX Threads
Post by: rgcustodio on January 25, 2010, 04:49:57 PM
I am by no means an expert but I'll to help.

Your BSP (board support package, if you have one) or your toolchain should provide a compiled pthreads library.

IIRC, POSIX threads have been integrated into gcc a long long time ago. You should try linking to the rt (realtime, AFAIK) library i.e. by adding an "-lrt" in your command line or Makefile.
Title: Re: POSIX Threads
Post by: pomprocker on January 25, 2010, 05:57:15 PM
Well the symptoms are the main binary 'cvoicecontrol' seems to lock up when I run it. I do a 'ps aux | grep cvoice' and i see 1 zombie process and 3 'D' type uninterpretable sleep processes...My first thought it poor thread management.

I also downloaded gdb from a packaging system, but it seems to have been compiled without pthread support...

I'll have to inspect the Makefile when I get home.


Also I do have libpthreads.so on my system..not sure if that is what it needs or not.

(sorry i'm more of a sys admin type)
Title: Re: POSIX Threads
Post by: rgcustodio on January 25, 2010, 08:47:13 PM
The library you mentioned is a shared library. Depends on the Makefile how the application uses the libraries. If its a static build it'll try to find the ".a" file. If its a dynamic build it use the ".so".

Since you're running on a PPC, it's likely an embedded system or an old mac with the G4/G5 processor. If your running embedded (WRS or MVL), did you compile your kernel properly i.e. with posix (semaphores, mqueues) support?

Since your a sysad you should know how to use strace. Give it a go. It might show some very important information.

Goodluck. Post your results.