Chinaunix首页 | 论坛 | 博客
  • 博客访问: 488699
  • 博文数量: 138
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 716
  • 用 户 组: 普通用户
  • 注册时间: 2015-03-03 21:48
文章分类

全部博文(138)

文章存档

2019年(1)

2017年(5)

2016年(99)

2015年(33)

我的朋友

分类: LINUX

2015-12-09 11:01:48

转载至 http://blog.sina.com.cn/s/blog_75acbe0b0101596n.html

Linux查看glibc版本信息(转)  (2012-11-29 16:21:10) 转载▼
标签:  杂谈
发表于 2012 年 7 月 25 日 由 wzw0114 ( )
1  centos(以centos 6.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 and GPLv2+
Signature : RSA/SHA1, 2012年05月10日 星期四 18时01分09秒, Key ID 0946fca2c105b9de
Packager : CentOS BuildSystem
URL :
Summary : The GNU libc libraries
Description :
The glibc package contains standard libraries which are used by
multiple programs on the system. In order to save disk space and
memory, as well as to make upgrading easier, common system code is
kept in one place and shared between programs. This particular package
contains the most important sets of shared libraries: the standard C
library and the standard math library. Without these two libraries, 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


2  ubuntu(以ubuntu 11.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:
Bugs:
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


参考资料:

!topic/xiyoulinux/lrFsdoKoYLQ
阅读(1986) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~