LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   detect glibc version based on libpthread.so (https://www.linuxquestions.org/questions/linux-newbie-8/detect-glibc-version-based-on-libpthread-so-627968/)

bootkernel 03-14-2008 02:21 AM

detect glibc version based on libpthread.so
 
Hi,all
I have a libpthread.so,want to know which glibc version compiled this pthread.so
run
Code:

string libpthread.so | grep GLIBC
results:
Code:

GLIBC_2.0
GLIBC_2.1
GLIBC_2.1.1
GLIBC_2.1.2
GLIBC_2.2
GLIBC_2.2.3
GLIBC_2.2.6
GLIBC_2.3.2
GLIBC_PRIVATE
GLIBC_2.1.3
GLIBC_2.3

from above message,can i guess that glibc 2.3.2 version compiled this pthread.so

thanks in advance

Lynn

osor 03-15-2008 01:56 PM

Quote:

Originally Posted by bootkernel (Post 3088276)
from above message,can i guess that glibc 2.3.2 version compiled this pthread.so

No, you cannot. Those are members of the version section which give compatibility of specific symbols to specific versions. More detailed information is provided by:
Code:

readelf -V libpthread.so
I am not sure of a reliable way to find out the version of libpthread (at least not without debugging symbols). If you have debugging symbols compiled-in, you can search for the symbol named:
Code:

nptl_version
If you don’t have debugging symbols compiled-in, you have to find this unnamed symbol by other known symbols around it.

I tried this GNU grep out on Gentoo (with glibc-2.7 on amd64) and Ubuntu 7.10 (glibc-2.6.1 on i386), and it gave what you wanted (I am not sure if it will work with earlier or alternate arch versions of glibc):
Code:

grep -az -B30 'Native POSIX Threads Library' libpthread.so
You might have to adjust the number 30 a bit to match yours. If you want the actual version string only:
Code:

grep -az -B30 'Native POSIX Threads Library' libpthread.so | tr '\0' '\n' | head -1


All times are GMT -5. The time now is 09:02 AM.