处理缺少动态链接库的通用方法

在公司里,SA习惯把很多包直接拷贝到其他的机器上,因为缺少包管理工具做依赖性的检查。经常遇到开发找我解决一些缺失动态连接库引起的问题。
其实解决起来也很简单ldd查看一下到底少什么库,再google一下对应的库是属于什么包的,然后装上就OK了。已今天遇到的mod_ssl.so不能加载的问题为例。
[text]
# ldd mod_ssl.so
linux-gate.so.1 => (0xffffe000)
libssl.so.4 => not found
libcrypto.so.4 => not found
libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0xf7f31000)
libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0xf7e9b000)
libcom_err.so.2 => /lib/libcom_err.so.2 (0xf7e97000)
libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0xf7e71000)
libresolv.so.2 => /lib/libresolv.so.2 (0xf7e5e000)
libdl.so.2 => /lib/libdl.so.2 (0xf7e5a000)
libz.so.1 => /usr/lib/libz.so.1 (0xf7e47000)
libpthread.so.0 => /lib/libpthread.so.0 (0xf7e2f000)
libc.so.6 => /lib/libc.so.6 (0xf7ce8000)
libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0xf7cdf000)
libkeyutils.so.1 => /lib/libkeyutils.so.1 (0xf7cdc000)
/lib/ld-linux.so.2 (0x00a3e000)
libselinux.so.1 => /lib/libselinux.so.1 (0xf7cc4000)
libsepol.so.1 => /lib/libsepol.so.1 (0xf7c7e000)
[/text]
搜了一下这个是老的openssl0.97上的库,yum安装一下就解决了。
[text]
yum install openssl097a.x86_64 openssl097a.i386
[/text]
其实回想我在刚接触linux的时候,在上面装Matlab是个很痛苦的事情,经常找很多库,尤其是那个时候用的fedora,国内的yum源又特别慢,包还特别少。所以就对这个事情特别擅长了,后面自己也玩过一点点嵌入式的东西,所以对这些大致有了了解。附上 man ldd

LDD(1) LDD(1)

NAME
ldd – print shared library dependencies

SYNOPSIS
ldd [OPTION]… FILE…

DESCRIPTION
ldd prints the shared libraries required by each program or shared
library specified on the command line.

OPTIONS
–version
Print the version number of ldd.

-v –verbose
Print all information, including e.g. symbol versioning informa-
tion.

-u –unused
Print unused direct dependencies.

-d –data-relocs
Perform relocations and report any missing objects (ELF only).

-r –function-relocs
Perform relocations for both data objects and functions, and
report any missing objects or functions (ELF only).

–help Usage information.

此条目发表在OS分类目录。将固定链接加入收藏夹。

发表回复