Hi,
today I tried to set-up a java eclipse project for which I wanted to use odejava. In short, I failed in doing so
Here are my PC specs:
Mac OS X 10.5 Leopard on a macbook pro with intel dual core, mac java VM 1.5_something, eclipse 3.3, macports for all the handy linux/unix programs the mac shell didn’t offer and gcc4 by apple.
Now the long story:
First I found the pretty outdated files on odejava.dev.java.net in the Documents & files section.
After a quick search, I found a few threads about the libodejava.jnilib version in the CVS section of the said website.
The next step was to download ode-0.9 from ode.org (at that time, I hadn’t found out, that the buildscript would download it by itself …). I unpacked it into /usr/local/src/ and ./configured it, but the make after that failed:
The first problem was, that uint32 was already #defined by an apple .h file, so I edited the (forgot the path)/config.h file and commented out
#define unsigned short uint32
The second problem was, that Leopard already included some openGL stuff, that /usr/X11/lib wanted to include again, which caused a new error
ld: cycle in dylib re-exports with /usr/X11/lib/libGL.dylib
. after finding the following post http://trac.macports.org/projects/macports/ticket/12997 I removed every appearance of /usr/X11/lib from all Makefiles in the ode-0.9 download. Sounds like a solution from someone without bash/make skills … and so it is But after that ode compiled, and it installed
two files after calling make install: /usr/local/lib/libode.a and /usr/local/lib/libode.dylib
Then I went back to the odejava cvs checkout. I saved the checkout under /usr/local/src, installed dos2unix and automake over macports and tried to execute build-odejava-jni-osx.sh script in odejava/odejave-jni/build.
The first problem was, that the configure script of opende couldn’t identify the type of executable from the gcc compiler. I fixed that by adding
CFLAGS=
CXXFLAGS=
to line 2436 in the configure script generated from autogen.sh, between
ac_config_headers="$ac_config_headers include/ode/config.h"
and
DEPDIR="${am__leading_dot}deps"
I found that two lines by comparing the opende and ode-0.9 configure script, it was the only difference, and the ode script executed, while the opende script did not, so don’t ask my why it did work
After that, the big surprise, the script downloaded ode again (maybe I should look into such scripts the next time BEFORE I execute them), and tried to compile it, with the same problems I had the last time. That was the moment I stopped, and searched the odejava folder for some precompiled libs. I found the libodejava.jnilib along with other .so files and the dll, and copied it over into my eclipse project. Next I searched for jarfiles, and found the log4j and other jars and copied them over to my project, too. Last but not least I executed the ant buildfile in the odejava subfolder, which built me a handy odejava.jar, which joined the log4j jarfile in my project.
The next step was to add all the jars to the buildpath, and add the dir with the .jnilib and .so files to java.library.path and write some pretty simple main() method:
public static void main(String[] args)
{
String libraryVersion = Odejava.getLibraryVersion();
System.out.println( "Successfully loaded libarary version " + libraryVersion );
}
But it failed to run with the following message:
0 [main] FATAL odejava - Native code library failed to load. java.lang.UnsatisfiedLinkError: dCCylinderClass_get
Exception in thread "main" java.lang.NoClassDefFoundError
at org.odejava.Odejava.getLibraryVersion(Odejava.java:140)
(....)
Without adding the lib folder to java.library.path I got
0 [main] FATAL odejava - Native code library failed to load. java.lang.UnsatisfiedLinkError: no odejava in java.library.path
Exception in thread "main" java.lang.UnsatisfiedLinkError: ODEJAVA_VERSION_get
at org.odejava.ode.OdeJNI.ODEJAVA_VERSION_get(Native Method)
at org.odejava.ode.OdeConstants.<clinit>(OdeConstants.java:12)
at org.odejava.Odejava.getLibraryVersion(Odejava.java:140)
(....)
Searching for ‘dCCylinderClass_get’ got me 0 results, so I am stucked now, someone has some help?
Thanks in advance, and sorry for the lengthy post and bad english