Pthreads Example?

Please excuse the cross post to ME9210. After posting I realized that this forum is probably better suited.

Just purchased the JumpStart kit for the Me9210 device. Setup went smoothly and I was impressed with how easy the kit was able to get going.

I have been going through the example target programs and have been trying to compile and execute the “pthreads” example. All compiles well, however the example aborts when it can’t find “libpthreads.so.0”. It is correct in that the library is not in the /libs directory of the target. I’ve gone looking for it, but cannot seem to find it. I know how to compile and install LKM’s. I just cannot find the source for this module.

I’ve Googled for information on “pthreads”, but cannot find any source code for it, only a few references for “pthreads-stubs”.

I must be overlooking something simple here. Can someone help me resolve this? Thanks.

Doug Wendelboe
Advanced Monitoring Systems Inc.
Las Vegas, NV

I’ve found indication that “pthreads” may be part of either libc or glibc. One source of download is at:

http://pauillac.inria.fr/~xleroy/linuxthreads/

After extracting the source code from glibc, an LKM apparently must be formed. The resultant loadable kernel module can then be copied to the 9210 /lib directory.

Talking about application, there are two different possible scenarios…

1.- Managed make projects.
Managed make projects are independent of the rootfs projects and, therefore, talking about library dependencies, its not possible to resolve that dependencies.

  1. On the other hand you can add an application (application template) to your rootfs by using the graphic configuration tool, under rootfs item.
    This will add the applications you select to the build process and that applications will be installed in the rootfs. In this case, the rootfs builder will detect that you have application X that depends on library Y and that library will be added into the rootfs.

In your case, assuming that you are using scenario 1, the problem is that your application depends on pthread library, but this library is not present in the rootfs of the target. Therefore, when you run the application, it fails.

You can overcome this problem by doing following:
-Manually copying the libraries into the rootfs and creating a new rootfs (building). Then have to install the rootfs. If you are running from flash you should program the rootfs into the flash before running your pthread application. If you are running from nfs, installing should install the new libraries.

-Copying your application into the rootfs and building the rootfs. The rootfs builder will resolve the dependencies on your application and will automatically add the pthread library in the new rootfs. After that, you need to install the new rootfs.

The documentation describes how to build and add new contents to the rootfs.

The pthread library is included as a prebuild library.
The issue here is that it is not installed in the filesystem of the device.

That library is not installed by default to save space in the flash.

So the Pthreads sample application provided with the JumpStart kit will not run as compiled out of the box, and with the default Linux loaded on the ME9210 device. The modifications you mention above must be done to support use of Pthreads.

OK, with my Linux being a little rusty I’ll have to do some more manual reading.

Thanks for your comments.