aspose file tools*
The moose likes Linux / UNIX and the fly likes wrong ELF class: ELFCLASS64    Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "wrong ELF class: ELFCLASS64    " Watch "wrong ELF class: ELFCLASS64    " New topic
Author

wrong ELF class: ELFCLASS64

U-Wei Khew
Greenhorn

Joined: Nov 24, 2009
Posts: 5
Hi,

I am trying to run a Java program consisting of Berkeley XML librarys on a Linux system. After building the library, and running the program, I encounter this error:



This is the system that I am working on:



Any idea how do I resolve this?

Appreciate any help!

THanks!
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

Welcome to JavaRanch.

You say you are trying to run a program on a Linux system, but the output of uname -a says that it's SunOS, which is not Linux.

Your Java program is trying to load a native library /home/ukhew1/dbxml-2.4.16/install/lib/libdb_java-4.6.so, but it looks like that native library is not suitable for the operating system you're trying to run it on. It's probably a 64-bit library (guessing from the ELFCLASS64), and your operating system is most likely not 64-bit.

Make sure that you get a native library that's appropriate for the operating system you're using.

It also looks like your system has a Sun SPARC processor. You'll need a native library for that processor, and not one for Intel x86 processors, for example.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
U-Wei Khew
Greenhorn

Joined: Nov 24, 2009
Posts: 5
Hi Jesper,

Thanks!

Apologize for the miscommunication. I build the buildall.sh file on another Linux machine and this was the error:



Do you have any idea on how to build this properly?

THanks!
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

warning: sparc:v8plus architecture of input file `.libs/xa_map.o' is incompatible with i386:x86-64 output

This means you have an object file xa_map.o that was compiled for the SPARC processor, and gcc on Linux, running on an Intel x86 processor, can't use that file.

Delete all *.o files before you build it on Linux. Maybe you need to do make clean before you build it on Linux.
U-Wei Khew
Greenhorn

Joined: Nov 24, 2009
Posts: 5
Hi Jesper,

Thanks for the help.

Totally forgot that I change from a Solaris to a Linux.. thus the error.

Back to the error of wrong ELF class. I am trying to build the library for DBXML and that was the error. I understand that my OS is a 32 bit which I am unable to do anything about (because its a server Im running on). However I cant find the method to build this native library on 32 bits.
I tried using ./buildall.sh -b 32 as the argument ( as stated in the buildall.sh file) but the build is still in 64 bits:


From the Oracle forum, I gathered that we have to set the CFLAGS/CXXFLAGS/LDFLAGS in order to build a 32bit version by gcc...a method which he doesnt know too... Any idea how do we do that?

Thanks for your time!

U-Wei Khew
Greenhorn

Joined: Nov 24, 2009
Posts: 5
Hi Jesper!

I got my problem sorted out!
Apparently, my JVM was a 32 bit JVM.. which was unable to run with a 64bit native lib...

Downloaded a 64 bit JVM from java and eveything settled!
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

Good to hear that you solved it.

By the way, if you can run a 64-bit JVM on your system, then your OS must also be 64-bit and not 32-bit as you said - you can't run 64-bit software on a 32-bit OS (the other way around does work, however, on Intel x86 systems).
U-Wei Khew
Greenhorn

Joined: Nov 24, 2009
Posts: 5
Yes, it is a 64 bit OS... being a newbie, had quite a hard time finding out the environment properties...

Thanks once again!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: wrong ELF class: ELFCLASS64