一、什么是glibc、libc和glib
glibc是linux的GUN C函数库,是linux系统中最底层的API,几乎其它任何运行时库都依赖于glibc。glibc除了封装linux操作系统所提供的系统服务,它本身也提供了许多其它必要功能服务的实现,例如:动态加载模块libdl、实时扩展接口librt。
glibc安装:yum install glibc安装动态版本库,yum install glibc-static安装静态版本库。
libc是Linux下的ANSI C函数库,被glibc包含,一般只包括以下功能:
libc位于/usr/lib64/libc.so、/usr/lib64/libc.a。
glib是Linux下C的一些工具库,和glibc没有关系。
查看glibc版本:
方法一:
[root@ebs-19233 ~]# /lib/libc.so.6
GNU C Library stable release version 2.12, by Roland McGrath et al.
Copyright (C) 2010 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.4.7 20120313 (Red Hat 4.4.7-11).
Compiled on a Linux 2.6.32 system on 2015-05-27.
Available extensions:
The C stubs add-on version 2.1.2.
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
RT using linux kernel aio
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
.
方法二:
[root@ebs-19233 ~]# ldd --version
ldd (GNU libc) 2.12
Copyright (C) 2010 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.
由 Roland McGrath 和 Ulrich Drepper 编写。
ldd命令查看动态库或者可执行文件的依赖动态链接库,可以用于解决动态库缺失问题。
[root@ebs-19233 ~]# ldd /bin/sh
linux-vdso.so.1 => (0x00007fffc7361000)
libtinfo.so.5 => /lib64/libtinfo.so.5 (0x0000003207c00000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fcdec97b000)
libc.so.6 => /lib64/libc.so.6 (0x00007fcdec5e6000)
/lib64/ld-linux-x86-64.so.2 (0x00007fcdecb89000)