共享库 - 64 位 Ubuntu 上的 Java 32 位
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24543014/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Shared libraries - Java 32 bit on 64bit Ubuntu
提问by areyoujokingme
I am trying to run a Bioinformatics program for MRS spectrosopy analysis called "jMRUI". The executable for this program is a .sh with the following code:
我正在尝试运行一个名为“jMRUI”的用于 MRS 光谱分析的生物信息学程序。该程序的可执行文件是 .sh 文件,其中包含以下代码:
java -Xss2m -mx1200m -Djava.library.path=lib -jar lib/mrui.jar
I have both the 64bit and 32bitJDK 1.8 installed on my PC at the directory /usr/lib/jvm/.
我在我的 PC 上的 /usr/lib/jvm/ 目录中安装了64 位和 32 位JDK 1.8。
64bit found at: /usr/lib/jvm/jdk1.8.0_x64/bin/java
32bit found at: /usr/lib/jvm/jdk1.8.0_x86/bin/java
The pointersymbolic link at /usr/bin/java points to /etc/alternatives/java which points to /usr/lib/jvm/jdk1.8.0_x64/bin/java if the 64bit version is currently selected or /usr/lib/jvm/jdk1.8.0_x86/bin/java if 32bit is currently selected. Permissions of all three are below.
/usr/bin/java 处的指针符号链接指向 /etc/alternatives/java,如果当前选择了 64 位版本,则该链接指向 /usr/lib/jvm/jdk1.8.0_x64/bin/java 或 /usr/lib/ jvm/jdk1.8.0_x86/bin/java 如果当前选择了 32 位。所有三个的权限如下。
lrwxrwxrwx 1 root root 22 Jul 2 17:34 /usr/bin/java -> /etc/alternatives/java
lrwxrwxrwx 1 root root 34 Jul 2 18:29 /etc/alternatives/java -> /usr/lib/jvm/jdk1.8.0_x(VER#)/bin/java
-rwxr-xr-x 1 lillian lillian 5730 Mar 18 02:58 /usr/lib/jvm/jdk1.8.0_x64/bin/java
-rwxr-xr-x 1 lillian lillian 5730 Mar 18 02:58 /usr/lib/jvm/jdk1.8.0_x86/bin/java
I can switch between java versions simply with a bash script that runs the following code: From 32bit java back to 64bit java:
我可以简单地使用运行以下代码的 bash 脚本在 java 版本之间切换:从 32 位 java 回到 64 位 java:
#!/bin/sh
#the next 3 commands are only run initially to install the link alternative
#associations. I give everything the same priority of 1.
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_x64/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_x64/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.8.0_x64/bin/javaws" 1
echo 1 | sudo update-alternatives --config java
echo 1 | sudo update-alternatives --config javac
echo 1 | sudo update-alternatives --config javaws
From 64bit to 32bit:
从 64 位到 32 位:
#!/bin/sh
#the next 3 commands are only run initially to install the link alternative
#associations. I give everything the same priority of 1.
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_x86/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_x86/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.8.0_x86/bin/javaws" 1
echo 1 | sudo update-alternatives --config java
echo 1 | sudo update-alternatives --config javac
echo 1 | sudo update-alternatives --config javaws
This posttold me to also install the following packages for 32bit java. Here is output from all of the suggested test commands.
这篇文章告诉我还要为 32 位 java 安装以下软件包。这是所有建议的测试命令的输出。
readelf -l /usr/bin/java
Elf file type is EXEC (Executable file) Entry point 0x8048420 There are 8 program headers, starting at offset 52 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align PHDR 0x000034 0x08048034 0x08048034 0x00100 0x00100 R E 0x4 INTERP 0x000134 0x08048134 0x08048134 0x00013 0x00013 R 0x1 [Requesting program interpreter: /lib/ld-linux.so.2] LOAD 0x000000 0x08048000 0x08048000 0x00710 0x00710 R E 0x1000 LOAD 0x000710 0x08049710 0x08049710 0x00144 0x0014c RW 0x1000 DYNAMIC 0x00072c 0x0804972c 0x0804972c 0x00108 0x00108 RW 0x4 NOTE 0x000148 0x08048148 0x08048148 0x00044 0x00044 R 0x4 GNU_EH_FRAME 0x00069c 0x0804869c 0x0804869c 0x0001c 0x0001c R 0x4 GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4 Section to Segment mapping: Segment Sections... 00 01 .interp 02 .interp .note.ABI-tag .note.gnu.build-id .hash .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_d .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame 03 .ctors .dtors .jcr .data.rel.ro .dynamic .got .got.plt .data .bss 04 .dynamic 05 .note.ABI-tag .note.gnu.build-id 06 .eh_frame_hdr 07
ls -l /lib/ld-linux.so.2
lrwxrwxrwx 1 root root 25 Apr 12 05:44 /lib/ld-linux.so.2 -> i386-linux-gnu/ld-2.19.so
ldd java
linux-gate.so.1 => (0xf775c000) libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf7728000) libjli.so => not found libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf7722000) libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7573000) /lib/ld-linux.so.2 (0xf775d000)
Since libjli.so was not found, I have tried to apt-get at pretty much any recommended package involved with i386. None have changed the "not found" status of libjli.so to found.
readelf -l /usr/bin/java
Elf file type is EXEC (Executable file) Entry point 0x8048420 There are 8 program headers, starting at offset 52 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align PHDR 0x000034 0x08048034 0x08048034 0x00100 0x00100 R E 0x4 INTERP 0x000134 0x08048134 0x08048134 0x00013 0x00013 R 0x1 [Requesting program interpreter: /lib/ld-linux.so.2] LOAD 0x000000 0x08048000 0x08048000 0x00710 0x00710 R E 0x1000 LOAD 0x000710 0x08049710 0x08049710 0x00144 0x0014c RW 0x1000 DYNAMIC 0x00072c 0x0804972c 0x0804972c 0x00108 0x00108 RW 0x4 NOTE 0x000148 0x08048148 0x08048148 0x00044 0x00044 R 0x4 GNU_EH_FRAME 0x00069c 0x0804869c 0x0804869c 0x0001c 0x0001c R 0x4 GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4 Section to Segment mapping: Segment Sections... 00 01 .interp 02 .interp .note.ABI-tag .note.gnu.build-id .hash .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_d .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame 03 .ctors .dtors .jcr .data.rel.ro .dynamic .got .got.plt .data .bss 04 .dynamic 05 .note.ABI-tag .note.gnu.build-id 06 .eh_frame_hdr 07
ls -l /lib/ld-linux.so.2
lrwxrwxrwx 1 root root 25 Apr 12 05:44 /lib/ld-linux.so.2 -> i386-linux-gnu/ld-2.19.so
ldd 爪哇
linux-gate.so.1 => (0xf775c000) libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf7728000) libjli.so => not found libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf7722000) libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7573000) /lib/ld-linux.so.2 (0xf775d000)
由于未找到 libjli.so,我尝试对几乎所有与 i386 相关的推荐软件包进行 apt-get。没有人将 libjli.so 的“未找到”状态更改为已找到。
When /usr/bin/java points to the 64bit java, jMRUI launches, but crashes when I try to upload an .SDAT file (basically when I open any file). When I try to open a file, I get this error message and then it hangs until you kill the process:
当 /usr/bin/java 指向 64 位 java 时,jMRUI 会启动,但是当我尝试上传 .SDAT 文件时(基本上是当我打开任何文件时)会崩溃。当我尝试打开一个文件时,我收到此错误消息,然后它会挂起,直到您终止该进程:
Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library
/home/lillian/Downloads/jMRUI-4.0/lib/libfftw.so which might have disabled stack
guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>',
or link it with '-z noexecstack'.
Exception in thread "Thread-1" java.lang.UnsatisfiedLinkError:
/home/lillian/Downloads/jMRUI-4.0/lib/libfftw.so: /home/lillian/Downloads/jMRUI-
4.0/lib/libfftw.so:
wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1847)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at fft.Fft.<clinit>(Unknown Source)
at mrui.data.FID.constructSpectrum(Unknown Source)
at mrui.data.Data.constructSpectrum(Unknown Source)
at mrui.data.Data.constructSpectrum(Unknown Source)
at mrui.data.Data.addSignal(Unknown Source)
at mrui.conversion.philips.FilePhil.loadData(Unknown Source)
at mrui.plugin.conversion.ConversionManager.loadFile(Unknown Source)
at mrui.plugin.conversion.FileManagementRead.loadInBackground(Unknown Source)
at mrui.plugin.conversion.FileManagementRead.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
When /usr/bin/java points to the 32bit java, jMRUI does not launch at all, and I get this error message:
当 /usr/bin/java 指向 32 位 java 时,jMRUI 根本不启动,我收到此错误消息:
./jmrui.sh
Jul 02, 2014 6:56:04 PM mrui.Launcher main
INFO: Log properties loaded
Exception in thread "main" java.lang.UnsatisfiedLinkError:
/usr/lib/jvm/jdk1.8.0_x86/jre/lib/i386/libawt_xawt.so: libXrender.so.1:
cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1814)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1083)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1835)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at java.awt.Toolkit.run(Toolkit.java:1651)
at java.awt.Toolkit.run(Toolkit.java:1649)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.loadLibraries(Toolkit.java:1648)
at java.awt.Toolkit.<clinit>(Toolkit.java:1683)
at sun.awt.AppContext.run(AppContext.java:275)
at sun.awt.AppContext.run(AppContext.java:264)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.AppContext.initMainAppContext(AppContext.java:264)
at sun.awt.AppContext.access0(AppContext.java:133)
at sun.awt.AppContext.run(AppContext.java:319)
at sun.awt.AppContext.run(AppContext.java:302)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.AppContext.getAppContext(AppContext.java:301)
at javax.swing.SwingUtilities.appContextGet(SwingUtilities.java:1860)
at javax.swing.UIManager.getLAFState(UIManager.java:243)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:529)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:579)
at mrui.Launcher.main(Unknown Source)
This sitetold me the 64bit error message is because jMRUI requires 32bit java, so that's why I have both.
该站点告诉我 64 位错误消息是因为 jMRUI 需要 32 位 java,所以这就是我同时拥有两者的原因。
Again, this sitetells me 32bit java isn't working because I am "trying to run a 64bit system without a 32bit runtime environment".
同样,这个站点告诉我 32 位 java 不起作用,因为我“试图在没有 32 位运行时环境的情况下运行 64 位系统”。
Lastly, this sitetold me to add the -d32 option in my jMRUI.sh bash script. It did not change the shared library error message outcome.
最后,该站点告诉我在 jMRUI.sh bash 脚本中添加 -d32 选项。它没有更改共享库错误消息结果。
What oh what am I missing? I can't imagine I haven't given enough information, but if you need anything else to help debug this, let me know and I'll send the output your way. Thanks a million in advance!
哦,我错过了什么?我无法想象我没有提供足够的信息,但是如果您需要其他任何东西来帮助调试,请告诉我,我会按照您的方式发送输出。提前一百万感谢!
回答by morgano
Having a look at the error messages, I have some conclusions:
看看错误信息,我有一些结论:
you definitely need to run the 32 bit version, the native library in
jMRUI-4.0/lib/libfftw.so
is ELF32when you run the 32 bit version, the system looks for a missing library: 'libXrender.so.1' (the 32bit version).
你肯定需要运行32位版本,本地库
jMRUI-4.0/lib/libfftw.so
是ELF32当您运行 32 位版本时,系统会查找缺少的库:'libXrender.so.1'(32 位版本)。
Install the package "libxrender1:i386" (libXrender 32bit) and try again with JDK 32 bit.
安装包“libxrender1:i386”(libXrender 32 位)并使用 JDK 32 位重试。