How to find out my libc (glibc) version?
To check your libc (glibc) version type “ls -l /lib/libc.” and hit TAB. This should expand the line into the name of your libc library file, e.g. something like /lib/libc.so.6
Umm… no, the .6 does not mean that your glibc version is 6, unfortunately it is a little more complicated than that 🙂 … but not too much!
Now that you know the name of the file run it as an executable, i.e. just type /lib/libc.so.6 in the console (or whatever your lib is named). It should dump lot’s of info that looks like this:
GNU C Library stable release version 2.8, by Roland McGrath et al.
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.3.0 20080428 (Red Hat 4.3.0-8).
Compiled on a Linux >>2.6.18-92.1.6.el5<< system on 2008-07-16.
Available extensions:
The C stubs add-on version 2.1.2.
crypt add-on version 2.1 by Michael Glad and others
GNU Libidn by Simon Josefsson
Native POSIX Threads Library by Ulrich Drepper et al
BIND-8.2.3-T5B
RT using linux kernel aio
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>
So as you can see your glibc (libc.so) version is 2.8.
Another approach would be to get it programatically as explained in this thread
2 Responses to How to find out my libc (glibc) version?
Leave a Reply Cancel reply
-
Categories
- Android Development
- Bash
- C programming
- dpkg/apt-get
- drupal
- Emacs
- Git
- Java
- Linux administration
- Linux device drivers
- Linux Gaming
- Linux kernel
- Linux Networking
- Linux on Windows
- Linux printing
- Linux sound and ALSA
- Package Managers
- Programming
- RPM
- Shell and environment
- Tips and tricks
- Uncategorized
- VirtualBox
- Virtualization
- web development
- wine
- WMaker
- Wordpress Tips
- X Window System
- XFCE
-
Articles
- May 2019
- July 2017
- February 2017
- January 2017
- November 2016
- October 2016
- September 2016
- August 2016
- July 2016
- June 2016
- April 2016
- March 2016
- December 2015
- November 2015
- September 2015
- June 2015
- May 2015
- April 2015
- March 2015
- February 2015
- January 2015
- December 2014
- October 2014
- February 2014
- January 2014
- November 2013
- October 2013
- June 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- October 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- September 2011
- August 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
-
Meta
Cloud
audio bash boot compile C programming cups drupal emacs etc Fedora git grep how to httpd init kernel libc linux linux partition localtime login make mount mp3 mysql networking oracle package managers password phpMyAdmin programming rpm shell sql vbox version control system virtual box vm web server wordpress www xargs xfce xwin yum
A simpler way is to use the ldd command to check the version.
#ldd –version
If you use dpkg, this will display a one-line summary of the libc *package* that you’re using:
dpkg-query -l libc6
— tip: this usage allows several patterns and globbing such asdpkg-query -l '*libc[^a-z]' '*libc'
Also with dpkg-query, a long report with more details:
dpkg-query -s libc6
And then
dpkg-query -W -f=... ...
allows some custom formatting of desired details, although, the format codes are a bit tough to figure out, not well documented in the manual page. For the details, refer to the source.If you (also) use aptitude, this will display a long report similar to (maybe the same as)
dpkg -s
(but as opposed to dpkg-query it needs a direct match for a package name, no globbing):aptitude show libc6
And then, to get back to the original article, sometimes there is no file matching /lib/libc.* (depending on the distro in use). But the proper use case of ldd helps here: given any dynamic executable that links to libc.so.6 (and as good as all dynamic executables do), specifying that executable’s name to ldd will cause ldd to display all the pathes to which the references *actually* will be resolved. Then, you can use that path to do as the article advises: execute the library file itself so that its stub displays its version information.
Here’s an example command to display both the pathname (to stderr) and the version information (to stdout):
$(ldd $(which bash) | grep -E "libc\." | sed -re 's/^ *[^ ]+ *=> *([^ ]*)( +.*)?$/\1/' | tee /dev/stderr )
(Notably, the package details as well as the version information from the libc executable itself also indicate whether a derivative libc is in use; for instance, eglibc has a version number alike to the original glibc, but seems to be independently maintained nowadays.)