wrong ELF class: ELFCLASS64 (Possible cause: architecture word widthmismatch)

T

TsanChung

I compiled my jMultidev.jar and libhwAPI_64.so with 64bit.
How to debug this error?
$ java -jar jMultidev.jar
Failed to load hwAPI and hwAPI_64 libraries.
java.lang.UnsatisfiedLinkError: /usr/jdk/instances/jdk1.6.0_07/jre/lib/
ext/libhwAPI_64.so: ld.so.1: java: fatal: /usr/jdk/instances/
jdk1.6.0_07/jre/lib/ext/libhwAPI_64.so: wrong ELF class: ELFCLASS64
(Possible cause: architecture word width mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1660)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1030)
at com.mycomp.crypto.hwAPI.<clinit>(hwAPI.java:47)
at com.mycomp.crypto.hwTokenManager.<init>(hwTokenManager.java:
101)
at
com.mycomp.crypto.hwTokenManager.getInstance(hwTokenManager.java:62)
at jMultidev.jMultidev.<init>(jMultidev.java:32)
at jMultidev.jMultidev.main(jMultidev.java:805)
Exception in thread "main" java.lang.UnsatisfiedLinkError:
com.mycomp.crypto.hwAPI.Initialize()V
at com.mycomp.crypto.hwAPI.Initialize(Native Method)
at com.mycomp.crypto.hwTokenManager.<init>(hwTokenManager.java:
107)
at
com.mycomp.crypto.hwTokenManager.getInstance(hwTokenManager.java:62)
at jMultidev.jMultidev.<init>(jMultidev.java:32)
at jMultidev.jMultidev.main(jMultidev.java:805)



OS is solaris 10 (SunOS 5.10 Generic sun4u sparc SUNW,Sun-Blade-2500).

$ java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)

CC: WorkShop Compilers 5.0 02/10/08 C++ 5.0 Patch 107311-19
/opt/SUNWspro/bin/../SC5.0/bin/c++filt: WorkShop Compilers 5.0
02/10/08 C++ 5.0 Patch 107311-19
ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.477
 
F

Frank Langelage

TsanChung said:
I compiled my jMultidev.jar and libhwAPI_64.so with 64bit.
How to debug this error?
$ java -jar jMultidev.jar
Failed to load hwAPI and hwAPI_64 libraries.
java.lang.UnsatisfiedLinkError: /usr/jdk/instances/jdk1.6.0_07/jre/lib/
ext/libhwAPI_64.so: ld.so.1: java: fatal: /usr/jdk/instances/
jdk1.6.0_07/jre/lib/ext/libhwAPI_64.so: wrong ELF class: ELFCLASS64
(Possible cause: architecture word width mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1660)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1030)
at com.mycomp.crypto.hwAPI.<clinit>(hwAPI.java:47)
at com.mycomp.crypto.hwTokenManager.<init>(hwTokenManager.java:
101)
at
com.mycomp.crypto.hwTokenManager.getInstance(hwTokenManager.java:62)
at jMultidev.jMultidev.<init>(jMultidev.java:32)
at jMultidev.jMultidev.main(jMultidev.java:805)
Exception in thread "main" java.lang.UnsatisfiedLinkError:
com.mycomp.crypto.hwAPI.Initialize()V
at com.mycomp.crypto.hwAPI.Initialize(Native Method)
at com.mycomp.crypto.hwTokenManager.<init>(hwTokenManager.java:
107)
at
com.mycomp.crypto.hwTokenManager.getInstance(hwTokenManager.java:62)
at jMultidev.jMultidev.<init>(jMultidev.java:32)
at jMultidev.jMultidev.main(jMultidev.java:805)



OS is solaris 10 (SunOS 5.10 Generic sun4u sparc SUNW,Sun-Blade-2500).

$ java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)

CC: WorkShop Compilers 5.0 02/10/08 C++ 5.0 Patch 107311-19
/opt/SUNWspro/bin/../SC5.0/bin/c++filt: WorkShop Compilers 5.0
02/10/08 C++ 5.0 Patch 107311-19
ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.477

You cannot compile java sources for 64bit.
They are independent of 32 or 64bit.

Try
java -d64 -jar jMultidev.jar
to force the use of the 64bit JVM.
 
T

TsanChung

You cannot compile java sources for 64bit.
They are independent of 32 or 64bit.

Try
    java -d64 -jar jMultidev.jar
to force the use of the 64bit JVM.
$ java -d64 -jar jMultidev.jar
Failed to load function 'CA_GetHAStatus'.
Exception in thread "main" com.mycomp.crypto.hwCryptokiException:
function 'CrystokiConnect failed' returns 0x0
at
com.mycomp.crypto.hwCryptokiException.ThrowNew(hwCryptokiException.java:
57)
at com.mycomp.crypto.hwAPI.Initialize(Native Method)
at com.mycomp.crypto.hwTokenManager.<init>(hwTokenManager.java:
107)
at
com.mycomp.crypto.hwTokenManager.getInstance(hwTokenManager.java:62)
at jMultidev.jMultidev.<init>(jMultidev.java:32)
at jMultidev.jMultidev.main(jMultidev.java:805)


However, the same source code works on a 64 bit linux computer (Linux
2.6.9-67.EL #1 Wed Nov 7 13:43:31 EST 2007 x86_64 x86_64 x86_64 GNU/
Linux).
java -d64 -jar jMultidev.jar
java -jar jMultidev.jar

Because java is write once, run everywhere, so I copy the jar files
from the linux computer to the solaris computer.
However,
java -d64 -jar jMultidev.jar
java -jar jMultidev.jar
both fails.

What is the problem?
Is it in libhwAPI_64.so?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top