glibc,就是Linux系统中的libc.so.6,而libc.so.6只是一个symlink,它会指向真正的.so文件。
$ ll /usr/lib/x86_64-linux-gnu/libc.so.6
lrwxrwxrwx 1 root root 12 Aug 17 22:02 /usr/lib/x86_64-linux-gnu/libc.so.6 -> libc-2.31.so*
三种方法查看glibc的版本:
方法一
If you want to find out about the version from the command line simply run the libc binary. This is probably not possible on all platforms but where it is simply locate the libc DSO and start it as an application. On Linux like
/lib/libc.so.6
This will produce all the information you need.
我在Ubuntu桌面上的测试:
$ /usr/lib/x86_64-linux-gnu/libc.so.6
GNU C Library (Ubuntu GLIBC 2.31-0ubuntu9.1) stable release version 2.31.
Copyright (C) 2020 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 9.3.0.
libc ABIs: UNIQUE IFUNC ABSOLUTE
For bug reporting instructions, please see:
.
方法二
Just execute:
ldd --version
which comes with glibc package.
root@ubuntu:/# ldd --version
ldd (Ubuntu GLIBC 2.23-0ubuntu7) 2.23
Copyright (C) 2016 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.
Written by Roland McGrath and Ulrich Drepper.
root@ubuntu:/#
方法三
写一个小程序,直接打印出glibc的版本号:
#include
#include
int main (void)
{
puts (gnu_get_libc_version ());
return 0;
}