共享库 - 64位Ubuntu上的Java 32位

时间:2014-07-03 00:08:42

标签: java ubuntu 32bit-64bit java-8

我正在尝试运行一个名为“jMRUI”的MRS光谱分析的生物信息学程序。该程序的可执行文件是.sh,代码如下:

    java -Xss2m -mx1200m -Djava.library.path=lib -jar lib/mrui.jar

我的PC上安装了64bit and 32bit JDK 1.8,目录为/ usr / lib / jvm /。

    64bit found at: /usr/lib/jvm/jdk1.8.0_x64/bin/java
    32bit found at: /usr/lib/jvm/jdk1.8.0_x86/bin/java

/ usr / bin / java中的指针符号链接指向/ etc / alternatives / java,如果是64位,则指向/usr/lib/jvm/jdk1.8.0_x64/bin/java如果当前选择了32位,则当前选择版本或/usr/lib/jvm/jdk1.8.0_x86/bin/java。三者的权限都在下面。

    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

我可以使用运行以下代码的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

从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 post告诉我还要为32位java安装以下软件包。这是所有建议的测试命令的输出。

  1. 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     
    
  2. 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
    
  3. 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) 
    
  4. 由于找不到libjli.so,我试图在任何与i386有关的推荐软件包中使用apt-get。没有人改变libjli.so的“未找到”状态。

  5. 当/ 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)
    

    当/ 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$3.run(Toolkit.java:1651)
        at java.awt.Toolkit$3.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$2.run(AppContext.java:275)
        at sun.awt.AppContext$2.run(AppContext.java:264)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.awt.AppContext.initMainAppContext(AppContext.java:264)
        at sun.awt.AppContext.access$400(AppContext.java:133)
        at sun.awt.AppContext$3.run(AppContext.java:319)
        at sun.awt.AppContext$3.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 site告诉我64位错误消息是因为jMRUI需要32位java,所以这就是为什么我同时拥有它们。

    同样,this site告诉我32位java无法正常工作,因为我“试图运行没有32位运行时环境的64位系统”。

    最后,this site告诉我在jMRUI.sh bash脚本中添加-d32选项。它没有更改共享库错误消息结果。

    我错过了什么?我无法想象我没有提供足够的信息,但如果你还需要其他任何东西来帮助调试,请告诉我,我会按照你的方式发送输出。提前感谢一百万!

1 个答案:

答案 0 :(得分:4)

看一下错误信息,我得出了一些结论:

  • 你肯定需要运行32位版本,jMRUI-4.0/lib/libfftw.so中的本机库是ELF32

  • 运行32位版本时,系统会查找缺少的库:'libXrender.so.1'(32位版本)。

安装包“libxrender1:i386”(libXrender 32bit)并再次使用JDK 32位。