加载共享库时出错:libdl.so.2(和其他),没有这样的文件。图书馆存在

加载共享库时出错:libdl.so.2(和其他),没有这样的文件。图书馆存在

尝试从 .bin 文件安装 Java 应用程序。从命令行打开安装程序时,我看到以下错误:

[boxen]# ./ZendStudio-5_2_0.bin 
Preparing to install...
Extracting the JRE from the installer archive...
Unpacking the JRE...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...
awk: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
dirname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/bin/ls: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
basename: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
dirname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
basename: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
hostname: error while loading shared libraries: libnsl.so.1: cannot open shared object file: No such file or directory

Launching installer...

grep: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/tmp/install.dir.7515/Linux/resource/jre/bin/java: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory

...

问题是这些对象中的每一个都存在于系统上。

# locate libdl.so.2
/usr/lib/libdl.so.2
/usr/lib64/libdl.so.2

# locate libc.so.6
/usr/lib/libc.so.6
/usr/lib/i686/nosegneg/libc.so.6
/usr/lib64/libc.so.6

# locate libnsl.so.1
/usr/lib/libnsl.so.1
/usr/lib64/libnsl.so.1

如果我发出这个,

echo $LD_LIBRARY_PATH

我什么也没得到。

因此,我将包含目录添加到路径中:

[boxen]# LD_LIBRARY_PATH=/usr/lib:/usr/lib64/:/usr/local/lib/:/usr/local/lib64/
[boxen]# echo $LD_LIBRARY_PATH
/usr/lib:/usr/lib64/:/usr/local/lib/:/usr/local/lib64/

并重新运行安装程序...

[boxen]# ./ZendStudio-5_2_0.bin 
Preparing to install...
Extracting the JRE from the installer archive...
Unpacking the JRE...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...
awk: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
dirname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/bin/ls: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
basename: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
dirname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
basename: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
hostname: error while loading shared libraries: libnsl.so.1: cannot open shared object file: No such file or directory

Launching installer...

grep: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/tmp/install.dir.8055/Linux/resource/jre/bin/java: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory

...

完全相同的一批错误。

安装的Java版本:

java version "1.7.0_65"
OpenJDK Runtime Environment (rhel-2.5.1.2.el7_0-x86_64 u65-b17)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

安装了glib:

# rpm -qa | grep glibc
glibc-2.17-55.el7.i686
glibc-2.17-55.el7.x86_64
glibc-headers-2.17-55.el7.x86_64
glibc-common-2.17-55.el7.x86_64
glibc-devel-2.17-55.el7.x86_64

是什么导致安装程序看不到明显存在于环境变量中的文件?

答案1

我很幸运能够偶然发现这个解决方案,但想将其发布,以防其他人在安装遗留软件时遇到这个问题。

Assuming the install anywhere script is called Install.bin

# cp Install.bin Install.bak
# cat Install.bak | sed "s/export LD_ASSUME_KERNEL/#xport LD_ASSUME_KERNEL/" > Install.bin
# rm Install.bak

这很有效。

该修复最初发布在Zend 知识库(现在是 404'ed),它仍然存档于linuxquestions.org

相关内容