views:

264

answers:

1

I need a non-stripped version of libpthread.so for debugging. How can I compile it from source code? Host is Linux 2.6.

A: 

If you're on an RPM based system, use rpm -qf .../libpthread.so to find out which package installed the file (if that doesn't produce a result, the .so file is probably a link; then run the command on the file the link points to).

If you have the package name, search for the "source package". How this works depends on the distribution you use. For openSUSE, you must add the Source Repository using Yast. After that, you can install the source package which will give you some entries under /usr/src/packages. To build the package, go to /usr/src/packages/SPECS and run rpmbuild with the pthread.spec file as parameter.

When the build suceeds, edit the .spec file and change it so it doesn't strip the symbols.

Alternatively, look if there is a *-debug package (replace "*" with the name of the package) and install that. It should contain the version of the library with the symbols.

Aaron Digulla
On APT-based systems, the debug packages are generally named `-dbg` (eg. `libc6-dbg` is where you'll find the pthreads library compiled with debugging info on Debian).
caf
unfortunately, i don't have RPM or APT. So I am looking for a way to build it from source code...
Tristan Su
On my system, libpthread comes with glibc: http://www.gnu.org/software/libc/
Aaron Digulla
@Aaron: can libpthread be built without other glibc modules? I don't need glibc? I don't know how to do that
Tristan Su
What's the problem with building all of glibc? Just build it with debug symbols and then search for the new libpthread.so and copy it manually.
Aaron Digulla