[Odejava] Compiling ODE natives for Mac OS X

Hello,

I’m trying to compile ODE natives for Mac OS X by following the instructions in odejava-jni/src/readme.txt but I’m having problems compiling ode rev 996:


odejava/odejava-jni joh$ svn co https://svn.sourceforge.net/svnroot/opende/trunk opende -r 996
<snip>
odejava/odejava-jni joh$ cd opende/
odejava/odejava-jni/opende joh$ patch -p0 --dry-run < ../src/ode.patch 
patching file include/ode/common.h
patching file include/ode/objects.h
patching file include/ode/odecpp.h
patching file ode/src/error.cpp
patching file ode/src/joint.cpp
patching file ode/src/joint.h
patching file ode/src/timer.cpp
odejava/odejava-jni/opende joh$ export CFLAGS="-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk" 
odejava/odejava-jni/opende joh$ export CXXFLAGS="-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
odejava/odejava-jni/opende joh$ sh autogen.sh
<snip>
odejava/odejava-jni/opende joh$ ./configure --disable-dependency-tracking
<snip>
Configuration:
  Target system type:      powerpc-apple-darwin8.9.0
  Build  system type:      powerpc-apple-darwin8.9.0
  Host   system type:      powerpc-apple-darwin8.9.0
  Use double precision:    no
  Use OPCODE:              yes
  Use gyroscopic term:     yes
  Is this a Pentium:       no
  Is the CPU x86-64:       no
  Is this a release build: no
  Is this a debug build:   no
  Using SONAME:           no
  Headers will be installed in /usr/local/include/ode
  Libraries will be installed in /usr/local/lib
odejava/odejava-jni/opende joh$ cd ode
odejava/odejava-jni/opende/ode joh$ make
<snip>
Making all in test
g++ -DHAVE_CONFIG_H -I. -I. -I../../include/ode    -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -I../../include -I../../include -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -c -o test_collision.o test_collision.cpp
make[1]: *** No rule to make target `../../drawstuff/src/libdrawstuff.a', needed by `test_collision'.  Stop.
make: *** [all-recursive] Error 1

Anyone know how I can fix this?

  • joh

Compiling without tests should be fine. You are missing the drawstuff but it’s not needed for the odelib. Simply go on with the next steps.

Ah great! You see, I tried that and didn’t really look closely enough at the errors I got and just assumed it was because ode seemed to fail to compile. But I finally got it working now with these altered commands compared to the ones from readme.txt… You might want to update that section :slight_smile:


odejava/odejava-jni/opende joh$ export JAVA_INCLUDE=/Library/Java/Home/include

odejava/odejava-jni/opende joh$ g++ -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fPIC -DHAVE_CONFIG_H -I. -Iinclude/ode -O2 -fno-strict-aliasing -fomit-frame-pointer -ffast-math -Iinclude -Iinclude -IOPCODE -IOPCODE/Ice -I$JAVA_INCLUDE/linux -I$JAVA_INCLUDE -I../src/c -DdTRIMESH_ENABLED -c -o ../bin/odejava_wrap.o ../generated/odejava_wrap.cxx

odejava/odejava-jni/opende joh$ g++ -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fPIC -DHAVE_CONFIG_H -I. -Iinclude/ode -O2 -fno-strict-aliasing -fomit-frame-pointer -ffast-math -Iinclude -Iinclude -IOPCODE -IOPCODE/Ice -I$JAVA_INCLUDE/linux -I$JAVA_INCLUDE -DdTRIMESH_ENABLED -c -o ../bin/odejava.o ../src/c/odejava.cpp

odejava/odejava-jni/opende joh$ g++ -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fPIC -dynamiclib `find ode/src -name *.o` ../bin/odejava_wrap.o ../bin/odejava.o -o lib/libodejava.so

Rename lib/libodejava.so to libodejava.jnilib and put it somewhere in your java library path :slight_smile:

irrisor, let me know if you want my libodejava.jnilib for jMEphysics2 :slight_smile:

sure, that’d be great - is it universal (intel and mac)?

What did you have to change in those lines?