Use ldd --version:
Copy$ ldd --version
ldd (GNU libc) 2.17
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
...
You can also run libc itself:
Copy$ /lib/libc.so.6
GNU C Library (GNU libc) stable release version 2.17, by Roland McGrath et al.
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
...
Write a test program (name it for example glibc-version.c):
Copy#include <stdio.h>
#include <stdlib.h>
#include <gnu/libc-version.h>
int main(int argc, char *argv[]) {
printf("GNU libc version: %s\n", gnu_get_libc_version());
exit(EXIT_SUCCESS);
}
and compile it with the gcc-4.4 compiler:
Copygcc-4.4 glibc-version.c -o glibc-version
When you execute ./glibc-version the used glibc version is shown.
For glibc:
/lib/libc.so.6
Sounds maybe strange to run a so file but should print out version information in this case
For the kernel version use uname
For the binutils parsing the output of ld --versionmight yield what you expect, the same for gcc --version. This is a bit tedious but I do not know another way.
$ ldd --version
ldd (GNU libc) 2.39
Distributions ship with older/newer glibc versions depending in the stability wanted.
From all reading it seems that glibc cannot be manually updated on a system; the only way to version up with it is to jump to a complete newer version of a Linux operating system. Is this true?
No. glibc is updated every time your package manager finds a new version of glibc. The main file is /lib/libc.so.6. Which is the dynamic library programs are linked to (so they can run C functions included in the C standard library).
Although you can update glibc manually by compiling a desired version of glib and copying the resulting libc.so.6 to lib, this isn't recommended because the binaries could complain at the moment of execution, and because newer versions of glibc haven't been tested by the distribution's package maintainers. So you can expect an unstable system.
There are versioned symbols within the library. If the new code hits one of the versioned symbols, and that version is newer than anything in your libc, you’ll not be able to run
Can they build static?