I’m using oprofile when profiling applications.
Unfortunately, the default glibc version that comes with SUSE 11.1 has the debug symbols stripped-out. That means that all libc functions get aggregated into one big blob under “glibc.so” and you can’t tell whether you spend most of the time in memory allocation, syslog or lock related routines.
So, I’ve tried a myriad of different ways of getting the symbols. From trying to build glibc myself to hunting for dozens of different rpms on this site and on the Internet. So far - no positive results.
Well, it looks like glibc-profile package (which I did install) is only for gprof profiling. Meaning that the applications being profiled have to be recompiled with -pg option. Furthermore, libc in glibc-profile package is distributed only as a static library. It’s hard for me to get the code re-compiled with that switch. Oprofile on the other hand can profile existing executables without the need to re-compile.
I just need the debug symbolls, that’s it. But it seems like an unsurmountable obstacle.
P.S. BTW, what is the reason behind stripping the debug symbols? Disk space?
It is a standard thing to have the debug symbols in a separate package.
debian does the same, it maybe does not make much sense in a standard
desktop linux distro (it sure makes sense for a minimal distro for special
purposes). But I do not really know.
I was surprised that therei sno glibc-debug package, so I looked at the
opensuse build service
(the idea is to rebuild glibc.rpm from glibc-source.rpm but withoug a step that strips out the symbolls)
first, install the glibc-source package that comes with the standard 11.1 distro. This package puts some files into /usr/src/packages and its subdirectories (particularly into SPECS and SOURCES). Then cd into /usr/src/packages/SPECS there should be a file called glibc.spec. Edit this file. Search for
remove the <…> part, keeping only the star.
This will tell the find_debug.sh script to not strip any of the produced files (I hope that’s what I wanted).
Next, start the rpm build procedure:
rpmbuild -bb libc.spec
If it fails, most probably it’s due to some missing standard packages. In my case I needed to install stdc+±devel, selenix-devel and patch packages.
Also, make sure that LD_LIBRARY_PATH is unset.
This step takes a while but at the end of the day you’ll get an libc rpm that was built just like the one that came with the original distro except it’ll contain symbolls for all libc related libraries.
Note: in my case rpmbuild actually failed trying to build some html ****. But by that time all libc related libraries were already built and copied to /var/tmp/glibc_build directory. For me it was just the matter of grabbing the right libraries and copying them over the existing ones. I ended up doing that by hand, but you’d probably want to use ldconfig for that.
Good to hear you solved it.
Thank you for sharing the solution. It is a bit surprising for me why there
is no package with the debug symbols available in the main repository for
this really central library.