我试图在运行NixOS的VM上安装当前的oracle jre。
现在发生以下情况:
[michas@cc:~]$ tar xvzf jre-7u40-linux-x64.tar.gz |grep bin/java
jre1.7.0_40/bin/javaws
jre1.7.0_40/bin/java_vm
jre1.7.0_40/bin/java
[michas@cc:~]$ ls -l ./jre1.7.0_40/bin/java
-rwxr-xr-x 1 michas nogroup 7750 Aug 27 09:17 ./jre1.7.0_40/bin/java
[michas@cc:~]$ ./jre1.7.0_40/bin/java
bash: ./jre1.7.0_40/bin/java: No such file or directory
WTF?命名文件显然在那里。到底是怎么回事?
尝试进一步分析:
[michas@cc:~]$ strace ./jre1.7.0_40/bin/java
execve("./jre1.7.0_40/bin/java", ["./jre1.7.0_40/bin/java"], [/* 53 vars */]) = -1 ENOENT (No such file or directory)
write(2, "strace: exec: No such file or di"..., 40strace: exec: No such file or directory
) = 40
exit_group(1) = ?
+++ exited with 1 +++
[michas@cc:~]$ strace ./jre1.7.0_40/bin/jav
strace: Can't stat './jre1.7.0_40/bin/jav': No such file or directory
好的,一个真正丢失的文件的输出看起来有所不同。
[michas@cc:~]$ file ./jre1.7.0_40/bin/java
./jre1.7.0_40/bin/java: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, BuildID[sha1]=a558f547fe0b95fdc6a109cb7d9692d6d7969794, not stripped
[michas@cc:~]$ file ~/t
/home/michas/t: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped
后者是运行时没有问题的微型自编译二进制文件。两者看起来非常相似。因此,格式化二进制本身似乎很好。
[michas@cc:~]$ ldd ./jre1.7.0_40/bin/java
/run/current-system/sw/bin/ldd: line 116: ./jre1.7.0_40/bin/java: No such file or directory
似乎有关所需的共享库存在问题。
怎么回事,我该如何解决?
另请参见NixOS Wiki:如何打包封闭源软件
—
mucaho