Problem with odejava.jnilib on a Mac running Leopard

Hi everyone!



I've got this error message when I try to run a test using JMe Physics 2.



GRAVE: Native code library (32 and 64 bit library) failed to load:
java.lang.UnsatisfiedLinkError: /Users/matt/NetBeansProjects/MyProject/lib/native/libodejava.jnilib



CPU: Intel Core2duo (64bits)
OS : MacOS X Leopard.

Can you help me?

Thanks a lot.

Hi shr3dpit, are you using the libraries from the google code jME Physics repository? Also, did you follow any specific setup guide for jME Physics or do it on your own?

Hi nymon!



I'm using the librairies from http://jmephysics.googlecode.com/svn/trunk/.



I did the setup by my own without guide or anything.



It works nicely on Linux and Windows XP but not on MacOS. I mean examples work using jMe 2.0 on Leopard, but it doesn't work using jMe Physics.

Since you’ve had it running under Windows and Linux, I’m going to assume that you already knew to pick the correct native library. Also, I think you would have received a different error had you not done the setup correctly.



I’m kinda stumped as to why it wouldn’t work for you, as I have had it running on OSX myself. As an experiment, would you please try the newer jar and mac library found here. I havn’t committed the new ones yet, because I don’t feel they have been tested a thoroughly as I would like.

Thanks for the link nymon :wink:



But I've got the same problem with your librairy  :frowning:



Still the same error message :



GRAVE: Native code library (32 and 64 bit library) failed to load: java.lang.UnsatisfiedLinkError: /Users/matt/NetBeansProjects/myProject/lib/native/libodejava.jnilib:
java.lang.UnsatisfiedLinkError: /Users/matt/NetBeansProjects/myProject/lib/native/libodejava.jnilib:
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1822)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1739)
        at java.lang.Runtime.loadLibrary0(Runtime.java:823)
        at java.lang.System.loadLibrary(System.java:1030)
        at org.odejava.Odejava.<clinit>(Odejava.java:98)
        at com.jmex.physics.impl.ode.OdePhysicsSpace$OdeFactory.getImplementationVersion(OdePhysicsSpace.java:188)
        at com.jmex.physics.PhysicsSpace.scanAvailableImplementations(PhysicsSpace.java:373)
        at com.jmex.physics.PhysicsSpace.create(PhysicsSpace.java:340)
        at com.jmex.physics.util.SimplePhysicsGame.initSystem(SimplePhysicsGame.java:91)
        at com.jme.app.BaseGame.start(BaseGame.java:70)
        at test.physics.examples.ragdoll.TestSimpleRagDoll$2.run(TestSimpleRagDoll.java:124)
10 janv. 2009 19:16:09 com.jmex.physics.PhysicsSpace scanAvailableImplementations
ATTENTION: Failed to use physics implementation 'com.jmex.physics.impl.ode.OdePhysicsSpace$OdeFactory' due to Exception/Error: java.lang.UnsupportedOperationException: Failed to load natives
java.lang.UnsupportedOperationException: Failed to load natives
        at org.odejava.Odejava.init(Odejava.java:145)
        at com.jmex.physics.impl.ode.OdePhysicsSpace$OdeFactory.getImplementationVersion(OdePhysicsSpace.java:188)
        at com.jmex.physics.PhysicsSpace.scanAvailableImplementations(PhysicsSpace.java:373)
        at com.jmex.physics.PhysicsSpace.create(PhysicsSpace.java:340)
        at com.jmex.physics.util.SimplePhysicsGame.initSystem(SimplePhysicsGame.java:91)
        at com.jme.app.BaseGame.start(BaseGame.java:70)
        at test.physics.examples.ragdoll.TestSimpleRagDoll$2.run(TestSimpleRagDoll.java:124)
Caused by: java.lang.UnsatisfiedLinkError: /Users/matt/NetBeansProjects/myProject/lib/native/libodejava.jnilib:
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1822)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1739)
        at java.lang.Runtime.loadLibrary0(Runtime.java:823)
        at java.lang.System.loadLibrary(System.java:1030)
        at org.odejava.Odejava.<clinit>(Odejava.java:98)
        ... 6 more
10 janv. 2009 19:16:09 class test.physics.examples.ragdoll.TestSimpleRagDoll start()
GRAVE: Exception in game loop
java.lang.IllegalStateException: No physics implementation was registered nor found!
        at com.jmex.physics.PhysicsSpace.create(PhysicsSpace.java:348)
        at com.jmex.physics.util.SimplePhysicsGame.initSystem(SimplePhysicsGame.java:91)
        at com.jme.app.BaseGame.start(BaseGame.java:70)
        at test.physics.examples.ragdoll.TestSimpleRagDoll$2.run(TestSimpleRagDoll.java:124)



I don't understand, it's very strange... Any ideas?

Sorry but no ideas. I'll continue to think about it, but maybe Irrisor can drop some hints when he sees this.

I am running it on a MAC (32bit) just fine, does yours have a 64bit processor?  I wonder if that's the issue, there is a 64bit native for linux but not MAC :).  If it is we may need to get you (or someone w/ 64bit MAC) to compile needed library…

Definetly 64bit related…


    // Load odejava native library
    static {

    String lib_name = "odejava";
    String lib_name_64 = "odejava64";
    String library_path = System.getProperty("org.odejava.librarypath");
   
        try {
        if (library_path != null) {
        System.load(library_path + File.separator + System.mapLibraryName(lib_name));
        }
        else {
        System.loadLibrary(lib_name);
        }
           
        getLibraryVersion();
        }
        catch ( UnsatisfiedLinkError e ) {
          try {
            if (library_path != null) {
            System.load(library_path + File.separator + System.mapLibraryName(lib_name_64));
            }
            else {
            System.loadLibrary(lib_name_64);
            }
               
            getLibraryVersion();
            }
            catch ( UnsatisfiedLinkError e2 ) {
                log.log( Level.SEVERE, "Native code library (32 and 64 bit library) failed to load: " + e, e );
                loadNativeException = e;
            }
        }
        if ( loadNativeException == null ) {
            if ( !EXPECTED_ODEJAVA_VERSION.equals( getLibraryVersion() ) )
            {
                String message = "Wrong native version! Expected " + EXPECTED_ODEJAVA_VERSION +
                        ", but found " + getLibraryVersion();
                log.log( Level.SEVERE, message );
                loadNativeException = new UnsatisfiedLinkError( message );
            }
            else
            {
                log.log( Level.INFO, "OdeJava natives version " + getLibraryVersion() + " loaded." );
            }
        }
    }

Yes, you can try compiling a 64 bit native. But prepare yourself, it may take some dedication and time to get it all done. I am more then happy to help you through it, as I was doing this just a couple weeks ago.

Hey nymon you got a 64bit processor there??

http://en.wikipedia.org/wiki/OSx86



Talk to me privately about OS if you are interested…

Hi!!



I'm trying to recompile odejava.jnilib for my 64bits Mac.



I did with success all the step of the compilation. I just have a problem with the last compilation line :



AraKis:opende matt$ g++ -arch ppc -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -fPIC -dynamiclib `find ../../odejava-jni/src -name *.o` ../bin/odejava_wrap.o ../bin/odejava.o -o lib/libodejava.jnilib
Undefined symbols:
  "_dJointAttach", referenced from:
      _createContactJoints in odejava.o
  "_dSpaceCollide", referenced from:
      _spaceCollide in odejava.o
  "_dAreConnectedExcluding", referenced from:
      _nearCallback in odejava.o
  "_dCollide"Undefined symbols, referenced:
  " from:
_dJointAttach", referenced from     :
    _nearCallback2    _createContactJoints inin odejava.o
 odejava.o
    ""_dSpaceCollide", _dJointCreateContact", referenced from:referenced from
    :
    _spaceCollide in     odejava.o
 _createContactJoints in  "_dAreConnectedExcluding", odejava.o
 referenced from:
       "_dSpaceCollide2", referenced from:
      _Java_org_odejava_Odejava_spaceCollide2 in odejava.o
  "_dBodyIsEnabled", referenced from:
      _nearCallback in odejava.o
      _nearCallback in odejava.o
  "_dGeomGetBody", referenced from:
      _nearCallback2 in odejava.o
      _nearCallback2 in odejava.o
      _nearCallback in odejava.o
      _nearCallback in odejava.o
ld: symbol(s) not found
_nearCallback in odejava.o
  "_dCollide", referenced from:
 collect2:      _nearCallback2 ld returned 1 exit statusin
odejava.o
  "_dJointCreateContact", referenced from:
      _createContactJoints in odejava.o
  "_dSpaceCollide2", referenced from:
      _Java_org_odejava_Odejava_spaceCollide2 in odejava.o
  "_dBodyIsEnabled", referenced from:
      _nearCallback in odejava.o
      _nearCallback in odejava.o
  "_dGeomGetBody", referenced from:
      _nearCallback2 in odejava.o
      _nearCallback2 in odejava.o
      _nearCallback in odejava.o
      _nearCallback in odejava.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/aa/aaH1eZXtEwS6xr8Ze-w2HE+++TI/-Tmp-//cc3peIOR.out (No such file or directory)



Can you help me?  ://

Are you using the build-odejava-jni-osx.sh script?

I tryed with the script but :



Making all in drawstuff
Making all in src
g++ -DHAVE_CONFIG_H -I. -I../../include/ode   -g -I../../include -I../../include -g -O2 -g -I/usr/X11/include -L/usr/X11/lib -c -o libdrawstuff_a-drawstuff.o `test -f 'drawstuff.cpp' || echo './'`drawstuff.cpp
g++ -DHAVE_CONFIG_H -I. -I../../include/ode   -g -I../../include -I../../include -g -O2 -g -I/usr/X11/include -L/usr/X11/lib -c -o libdrawstuff_a-osx.o `test -f 'osx.cpp' || echo './'`osx.cpp
/System/Library/Frameworks/Security.framework/Headers/cssmconfig.h:64: error: conflicting declaration

Yeah, It took me a couple days to actually get it to build completely. I suggest executing the contents of the script line by line, because I had some issues just related to some silly thing that didn’t work in the script, but did when I typed it. Use this post as a guide, it lists all the gotchas that I ran into.

Hi,



i got this error too, but only if i try to start it from the shell. when i start my game from netbeans, it works.

im on mac os x(10.5.6) too with 64bit cpu

Has all this resulted in Mac 64bit natives? If so, would anyone be willing to share them with the world (and me)?