博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
查看当前系统的glibc版本
阅读量:4299 次
发布时间:2019-05-27

本文共 1955 字,大约阅读时间需要 6 分钟。

查看当前系统的glibc版本

2014年01月03日 15:50:25  阅读数:41406更多

个人分类: 

from 

 

 

有时我们经常需要查看当前系统的glibc版本,可以这样查看:

/lib/libc.so.6

有时:/lib/x86-64-linux/libc.so.6

把这个文件当命令执行一下

 

为什么这个库可以直接run呢? 原来在libc的代码中有一点小手脚:

Makerules:586:LDFLAGS-c.so += -e __libc_main 

csu/version.c:71:__libc_main (void) 

void 

__libc_main (void) 
  __libc_print_version (); 
  _exit (0); 

 

或者:

因为ldd命令也是glibc提供的,所以也能查看

ldd  --version

glibc是什么,以及与gcc的关系?

glibc是gnu发布的libc库,也即c运行库。glibc是linux 系统中最底层的api(应用程序开发接口),几乎其它任何的运行库都会倚赖于glibc。glibc除了封装linux操作系统所提供的系统服务外,它本 身也提供了许多其它一些必要功能服务的实现,主要的如下:
(1)string,字符串处理
(2)signal,信号处理
(3)dlfcn,管理共享库的动态加载
(4)direct,文件目录操作
(5)elf,共享库的动态加载器,也即interpreter
(6)iconv,不同字符集的编码转换
(7)inet,socket接口的实现
(8)intl,国际化,也即gettext的实现
(9)io
(10)linuxthreads
(11)locale,本地化
(12)login,虚拟终端设备的管理,及系统的安全访问
(13)malloc,动态内存的分配与管理
(14)nis
(15)stdlib,其它基本功能
gcc 是编译器,基本上 Linux 下所有的程序(包括内核)都是 gcc 编译的,libc 当然也是。
gcc 和 libc 是互相依赖的两个软件,它们合作的方式类似 Linux 系统的 "自举"。先在一个可以运行的带有老 libc 和 gcc 的系统上,用老 gcc 编译出一个新版本的 gcc + 老 libc,再用这个新 gcc 编译出一个新 gcc + 新 libc,再用这套东东编译整个新系统。

 

glibc版本查看

4.9. How can I find out which version of glibc I am using in the moment? {UD} If you want to find out about the version from the command line simply run the libc binary. This is probably not possible on all platforms but where it is simply locate the libc DSO and start it as an application. On Linux like /lib/libc.so.6 This will produce all the information you need. What always will work is to use the API glibc provides. Compile and run the following little program to get the version information: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #include 
#include
int main (void) { puts (gnu_get_libc_version ()); return 0; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This interface can also obviously be used to perform tests at runtime if this should be necessary.

 

Just execute:
ldd --version
which comes with glibc package

转载地址:http://skvws.baihongyu.com/

你可能感兴趣的文章
log日志记录是什么
查看>>
<rich:modelPanel>标签的使用
查看>>
<h:commandLink>和<h:inputLink>的区别
查看>>
<a4j:keeyAlive>的英文介绍
查看>>
关于list对象的转化问题
查看>>
VOPO对象介绍
查看>>
suse创建的虚拟机,修改ip地址
查看>>
linux的挂载的问题,重启后就挂载就没有了
查看>>
docker原始镜像启动容器并创建Apache服务器实现反向代理
查看>>
docker容器秒死的解决办法
查看>>
管理网&业务网的一些笔记
查看>>
openstack报错解决一
查看>>
openstack报错解决二
查看>>
linux source命令
查看>>
openstack报错解决三
查看>>
乙未年年终总结
查看>>
子网掩码
查看>>
第一天上班没精神
查看>>
启动eclipse报错:Failed to load the JNI shared library
查看>>
eclipse安装插件的两种方式在线和离线
查看>>