
正文
查询Linux系统中glibc的版本
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
编写一个简单的程序
#include <stdio.h>
int main()
{
printf("Hello world\n");
return ;
}
编译
gcc test.c
查看glibc的位置
ldd a.out | grep libc
在我的机器上显示
libc.so. => /lib/i386-linux-gnu/libc.so. (0xb757a000)
直接运行glibc共享库文件查看版本
$ /lib/i386-linux-gnu/libc.so.
在我的机器上显示
GNU C Library (Ubuntu EGLIBC 2.15-0ubuntu20) stable release version 2.15, by Roland McGrath et al.
Copyright (C) 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.6. (prerelease).
Compiled on a Linux 3.5. system on --.
Available extensions:
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.-T5B
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
<http://www.debian.org/Bugs/>.
还可以在运行时获取版本信息,使用API gnu_get_libc_version():
#include <stdio.h>
#include <gnu/libc-version.h>
int main()
{
printf("libc version : %s\n", gnu_get_libc_version());
return ;
}
运行后显示:
libc version : 2.15







