首页 > 系统服务 > 详细

查询Linux系统中glibc的版本

时间:2015-10-23 16:06:23      阅读:302      评论:0      收藏:0      [点我收藏+]

编写一个简单的程序

#include <stdio.h>
int main()
{
        printf("Hello world\n");
        return 0;
}

编译

gcc test.c

查看glibc的位置

ldd a.out | grep libc

在我的机器上显示

libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb757a000)

直接运行glibc共享库文件查看版本

$ /lib/i386-linux-gnu/libc.so.6

在我的机器上显示

GNU C Library (Ubuntu EGLIBC 2.15-0ubuntu20) stable release version 2.15, by Roland McGrath et al.
Copyright (C) 2012 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.3 20120918 (prerelease).
Compiled on a Linux 3.5.4 system on 2012-10-04.
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.3-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 0;
}

运行后显示:

libc version : 2.15

 

查询Linux系统中glibc的版本

原文:http://www.cnblogs.com/jingyg/p/4904665.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!