error while loading shared libraries *:No such file or directory

问题

在HP-UX系统尚执行命令时,报错

error while loading shared libraries: libacl.so: cannot open shared object file: No such file or directory
加载共享库时出错:libacl.so:无法打开共享对象文件:没有这样的文件或者目录

解决方案

它与这个特定的库文件无关。
这与定义共享库路径变量有关。

Linux/Unix

# find/-name "library file name" -type f

# find -name libacl.so -type f
/usr/lib

添加到库路径中:

# export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH

设置永久生效:

# vi /root/.bash_profile
export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH
#. /root/.bash_profile

如果find时没有找到库文件,我们需要安装。

下面是在 RedHat 和 CentOS 的操作步骤。

Linux查找库文件属于哪个安装包:

# yum whatprovides libacl.so
libacl-devel-2.2.49-6.el6.i686 : Access control list static libraries and
: headers
Repo : base
Matched from:
Filename : /usr/lib/libacl.so
Filename : /lib/libacl.so

找出rpm 软件包后,使用yum命令进行安装

# yum -y install libacl-devel

在 HP-UX 机器中

除了将保存路径的共享库位置之外,我们需要执行相同的步骤

# export SHLIB_PATH=/usr/lib:$SHLIB_PATH

修改 .bash_profile 执行同样的操作。

日期:2020-06-02 22:16:51 来源:oir作者:oir