Ubuntu下查看glibc版本


在Ubuntu下查看glibc版本我知道的方法有两种:

第一种为:ldd --version,其输出如下。

ldd (Ubuntu EGLIBC 2.19-0ubuntu6.6) 2.19
Copyright (C) 2014 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.
第二种方法为:getconf GNU_LIBC_VERSION。输出结果为:
glibc 2.19
由上可知glibc的版本为2.19.。


这两种方法都可以得到我们想要的结果。第一种方法只是通过输出ldd的版本号,间接地输出了glibc的版本;第二种方法就是一个很直接的方法得到glibc的版本。应该还有别的方法得到glibc的版本,如果知道后会继续添加上来。

以下是最新更新,第三种方法为通过编程得到glibc的版本。编写如下checklibcversion.c

#include <stdio.h>
#include <gnu/libc-version.h>
int main(void) { puts (gnu_get_libc_version ()); return 0; }
然后编译生成二进制文件checklibcversion,最后执行./checklibcversion即可打印出libc的版本。
$./checklibcversion
2.17

猜你喜欢

转载自www.cnblogs.com/alix-1988/p/12173393.html