Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

When building an application using g++, I am not explicitly passing the libc library as a library to link to in the same way you would for other libraries (like passing -lpthread for example). I know that libc has the so name but I am aware that this is not actually a library but something like a pointer to another version of libc (such as My question is if I had multiple versions of libc on my computer, how can I tell which one actually gets linked to through the

share|improve this question

1 Answer 1

up vote 9 down vote accepted

ldd should be the tool of your choice. That gives you the shared library actually linked.

confus@confusion:~/misc/test$ ldd -r -v testendian =>  (0x00007fffbcfff000) => /lib/x86_64-linux-gnu/ (0x00007f1a5a4c5000)
    /lib64/ (0x00007f1a5a8a5000)

    Version information:
    ./testendian: (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/
    /lib/x86_64-linux-gnu/ (GLIBC_2.3) => /lib64/ (GLIBC_PRIVATE) => /lib64/

In case of the libc you can simply run the .so file and will be told the library version.

confus@confusion:~/misc/test$ /lib/x86_64-linux-gnu/ 
GNU C Library (Ubuntu EGLIBC 2.15-0ubuntu10) stable release version 2.15, by Roland McGrath et al.
share|improve this answer
I did know about ldd, didn't know you could just run a library though - thanks. Unfortunately my output from running the library doesn't show the version.... – mathematician1975 Jul 13 '12 at 13:18
Disregard that I was being an idiot - thanks for the answer! – mathematician1975 Jul 13 '12 at 13:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.