Linux查看glibc版本信息

来源:互联网 发布:百度统计代码js安装 编辑:程序博客网 时间:2024/05/21 17:11

http://blog.sina.com.cn/s/blog_75acbe0b0101596n.html

centos(以centos6.0为例):

(1) 可通过rpm -qa | grep glibc查看系统目前安装了哪些和glibc有关的包:

[root@Cluster ~]# rpm -qa | grep glibc

glibc-2.12-1.47.el6_2.12.i686

glibc-headers-2.12-1.47.el6_2.12.x86_64

glibc-common-2.12-1.47.el6_2.12.x86_64

glibc-devel-2.12-1.47.el6_2.12.x86_64

glibc-2.12-1.47.el6_2.12.x86_64

可以看到系统上glibc的版本号为2.12。

如果想进一步查看,可通过rpm -qi glibc:

[root@Cluster ~]# rpm -qi glibc

Name : glibc Relocations: (not relocatable)

Version : 2.12 Vendor: CentOS

Release : 1.47.el6_2.12 Build Date: 2012年05月10日 星期四16时11分39秒

Install Date: 2012年05月21日 星期一 17时46分08秒 Build Host:c6b5.bsys.dev.centos.org

Group : System Environment/Libraries Source RPM:glibc-2.12-1.47.el6_2.12.src.rpm

Size : 12871227 License: LGPLv2+ and LGPLv2+ with exceptions andGPLv2+

Signature : RSA/SHA1, 2012年05月10日 星期四 18时01分09秒, Key ID0946fca2c105b9de

Packager : CentOS BuildSystem

URL : http://sources.redhat.com/glibc/

Summary : The GNU libc libraries

Description :

The glibc package contains standard libraries which are usedby

multiple programs on the system. In order to save disk spaceand

memory, as well as to make upgrading easier, common system codeis

kept in one place and shared between programs. This particularpackage

contains the most important sets of shared libraries: thestandard C

library and the standard math library. Without these twolibraries, a

Linux system will not function.

 

(2) 也可以通过查看ls -l /lib/libc.so.6输出结果:

[root@Cluster ~]# ls -l /lib/libc.so.6

lrwxrwxrwx. 1 root root 12 5月 21 17:46 /lib/libc.so.6 ->libc-2.12.so

 

ubuntu(以ubuntu11.04为例):

(1) 查看 ls -l /lib/i386-linux-gnu/libc.so.6的输出:

wzw@wzw-Lenovo:~$ ls -l /lib/i386-linux-gnu/libc.so.6

lrwxrwxrwx 1 root root 12 2012-07-15 09:14/lib/i386-linux-gnu/libc.so.6 -> libc-2.13.so

(2) 也可以使用 apt-cache show libc6:

wzw@wzw-Lenovo:~$ apt-cache show libc6

Package: libc6

Priority: required

Section: libs

Installed-Size: 9456

Maintainer: Ubuntu Core developers

Original-Maintainer: GNU Libc Maintainers

Architecture: i386

Source: eglibc

Version: 2.13-0ubuntu13

Replaces: belocs-locales-bin, libc6-i386

Provides: glibc-2.13-1, libc6-i686

Depends: libc-bin (= 2.13-0ubuntu13), libgcc1, tzdata

Suggests: glibc-doc, debconf | debconf-2.0, locales

Conflicts: belocs-locales-bin, libc6-i686, prelink (<<0.0.20090925), tzdata (<< 2007k-1), tzdata-etch

Breaks: nscd (<< 2.13)

Filename: pool/main/e/eglibc/libc6_2.13-0ubuntu13_i386.deb

Size: 3764596

MD5sum: 1cfb03baf7c299fcf266f1c9b20c00a5

SHA1: 2f2d25e96ae7a8f9489a460154ffc31460b2dead

SHA256:c3336e5b6480591925974be5329eaa56a5632697eeb4a75de52905b3efd65e81

Description-zh_CN: Embedded GNU C Library: Shared libraries

本软件包包含了系统中几乎所有程序都会用到的标准运行库,包括标准 C 语言共享库和标准数学 库,以及许多其它的运行库。

Multi-Arch: same

Homepage: http://www.eglibc.org

Bugs: https://bugs.launchpad.net/ubuntu/+filebug

Origin: Ubuntu

Supported: 18m

Task: minimal

 

3 发行版无关方法:

(1) 查看ldd –version的输出结果:

wzw@wzw-Lenovo:~$ ldd –version

ldd (Ubuntu EGLIBC 2.13-0ubuntu13) 2.13

版权所有 (C) 2011 Free Software Foundation, Inc.

这是自由软件;请参考原始码的版权声明。本软件不提供任何担保,甚至不会包括可售性或适用于任何特定目的的担保。

由 Roland McGrath 和 Ulrich Drepper 编写。

 

(2) 编译执行如下程序:

#include

#include

int main(void)

{

puts(gnu_get_libc_version ());

return 0;

}

wzw@wzw-Lenovo:~$ ./a.out

2.13

 

参考资料:

http://zhidao.baidu.com/question/380197848.html

https://groups.google.com/forum/?fromgroups#!topic/xiyoulinux/lrFsdoKoYLQ


0 0