[jME 2.0 jME Physics 2] Problems with odejava under Mac OS 10.4

Hi Folks,



I'm working with jME 1.0 and jME Physics 2 for jME 1.0 and now its finally time to port my projects to jME 2.0 and jME Physics 2 for jME 2.0.



My working platform:



Mac OS X 10.4.11 (8S165) ppc

Kernel-Version: Darwin 8.11.0



Eclipse SDK

Version: 3.4.1

Build id: M20080911-1700



Well I checked out all files for:



jME 2.0

http://jmonkeyengine.googlecode.com/svn/



jME Physics 2 for jME 2.0

http://jmephysics.googlecode.com/svn/trunk/



After the checkout I compiled jME 2.0 with no errors and all tests and demos worked fine. So I checked out jME Physics 2 and referenced the jME 2.0 project to it, to get all necessary classes and libs from the mother ship.



jME Physics 2 compiled fine after I changed the basedir entries in the build.xml and build.properties.default to my actual jME 2.0 folder/project name. (i.e. it was jme and mine is jme2)



Then I compiled jME Physics 2 and tried to run some tests from the tutorial folder.

Right after the default config screen, where you can set the window resolutions etc., remains the application window black and after some seconds the window gets closed with no error message to the console but with an OS dialog error box - that the application caused an error and was closed …



This happens with all tutorial or test files.



After some further tryouts I decided to get the odejava sources from:



cvs.dev.java.net:/cvs



to check if I've got an older or incompatible version to my system with the jME Physics 2 package.

I compiled the odejava-jni.jar from the sources and replaced the old lib in my jME Physics 2 project with this new one.



All test start now without an OS crash but with an runtime exception:


14.10.2008 00:26:35 org.odejava.Odejava <clinit>
SCHWERWIEGEND: Wrong native version! Expected 0.3.2, but found 0.3.1
14.10.2008 00:26:36 com.jmex.physics.PhysicsSpace scanAvailableImplementations
WARNUNG: 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:125)
   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:67)
   at com.jmetest.physicstut.Lesson1.main(Lesson1.java:106)
Caused by: java.lang.UnsatisfiedLinkError: Wrong native version! Expected 0.3.2, but found 0.3.1
   at org.odejava.Odejava.<clinit>(Odejava.java:105)
   ... 6 more



So the new compiled version of odejava-jni.jar is 0.3.2 and the native from the jME Physics 2 still is 0.3.1. Thats no wonder cause I didnt changed it. My next step was to get the 0.3.2 version of this natives for my system from the repositories or from some other source in the www - but I was unlucky.
The next thing I sad to me: "Hey I probably could compile it from the odejava sources!" ;) So i gave it a shot. Fortunately the sources included a build script build-odejava-jni-osx.sh.

Some words in front: I never ever compiled C++ libs for my OS or any other ;)
After I figured out what tools I needed and after 2 days of installation and configuration I've finally got the build script running ... untill:

====script fail ending===
Now you are ready to run ./configure
./build-odejava-jni-osx.sh: line 23: export: `-Wl,-syslibroot': not a valid identifier
./build-odejava-jni-osx.sh: line 23: export: `/Developer/SDKs/MacOSX10.4u.sdk': not a valid identifier
Running ./configure
checking build system type... powerpc-apple-darwin8.11.0
checking host system type... powerpc-apple-darwin8.11.0
checking target system type... powerpc-apple-darwin8.11.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
opende configure failed!

====config.log====
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by ODE configure 0.9.0, which was
generated by GNU Autoconf 2.59.  Invocation command line was

  $ ./configure --disable-dependency-tracking --without-tests

##


##
## Platform. ##
##
##

hostname = Kobalt-2.local
uname -m = Power Macintosh
uname -r = 8.11.0
uname -s = Darwin
uname -v = Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC

/usr/bin/uname -p = powerpc
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
hostinfo               = Mach kernel version:
    Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC
Kernel configured for a single processor only.
1 processor is physically available.
Processor type: ppc7450 (PowerPC 7450)
Processor active: 0
Primary memory available: 1.00 gigabytes
Default processor set: 85 tasks, 280 threads, 1 processors
Load average: 3.09, Mach factor: 0.20
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /sw/bin
PATH: /opt/local/bin
PATH: /bin
PATH: /sbin
PATH: /usr/bin
PATH: /usr/sbin


##
##
## Core tests. ##
##
##

configure:1389: checking build system type
configure:1407: result: powerpc-apple-darwin8.11.0
configure:1415: checking host system type
configure:1429: result: powerpc-apple-darwin8.11.0
configure:1437: checking target system type
configure:1451: result: powerpc-apple-darwin8.11.0
configure:1480: checking for a BSD-compatible install
configure:1535: result: /usr/bin/install -c
configure:1546: checking whether build environment is sane
configure:1589: result: yes
configure:1654: checking for gawk
configure:1683: result: no
configure:1654: checking for mawk
configure:1683: result: no
configure:1654: checking for nawk
configure:1683: result: no
configure:1654: checking for awk
configure:1670: found /usr/bin/awk
configure:1680: result: awk
configure:1690: checking whether make sets $(MAKE)
configure:1710: result: yes
configure:1892: checking for style of include used by make
configure:1920: result: GNU
configure:1991: checking for gcc
configure:2007: found /usr/bin/gcc
configure:2017: result: gcc
configure:2261: checking for C compiler version
configure:2264: gcc --version </dev/null >&5
powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 (Apple Computer, Inc. build 5026)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:2267: $? = 0
configure:2269: gcc -v </dev/null >&5
Using built-in specs.
Target: powerpc-apple-darwin8
Configured with: /private/var/tmp/gcc/gcc-5026.obj~19/src/configure --disable-checking --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^+.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/gcc/darwin/4.0/c++ --build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8
Thread model: posix
gcc version 4.0.0 (Apple Computer, Inc. build 5026)
configure:2272: $? = 0
configure:2274: gcc -V </dev/null >&5
gcc: argument to `-V' is missing
configure:2277: $? = 1
configure:2300: checking for C compiler default output file name
configure:2303: gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk  -arch ppc -arch i386 conftest.c  >&5
/usr/bin/ld: for architecture i386
/usr/bin/ld: warning fat file: /usr/lib/gcc/i686-apple-darwin8/4.0.0/../../../libmx.dylib does not contain an architecture that matches the specified -arch flag: i386 (file ignored)
/usr/bin/ld: warning fat file: /usr/lib/gcc/i686-apple-darwin8/4.0.0/../../../libSystem.dylib does not contain an architecture that matches the specified -arch flag: i386 (file ignored)
/usr/bin/ld: Undefined symbols:
___keymgr_dwarf2_register_sections
__cthread_init_routine
_atexit
_errno
_exit
_mach_init_routine
collect2: ld returned 1 exit status
lipo: can't open input file: /var/tmp//cc0B5MSd.out (No such file or directory)
configure:2306: $? = 1
configure: failed program was:
| /* confdefs.h.  */
|
| #define PACKAGE_NAME "ODE"
| #define PACKAGE_TARNAME "ode"
| #define PACKAGE_VERSION "0.9.0"
| #define PACKAGE_STRING "ODE 0.9.0"
| #define PACKAGE_BUGREPORT "ode@ode.org"
| #define PACKAGE "ODE"
| #define VERSION "0.9.0"
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:2345: error: C compiler cannot create executables
See `config.log' for more details.

##
##
## Cache variables. ##
##
##

ac_cv_build=powerpc-apple-darwin8.11.0
ac_cv_build_alias=powerpc-apple-darwin8.11.0
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk'
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_CXXFLAGS_set=set
ac_cv_env_CXXFLAGS_value='-arch ppc -arch i386'
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value='-arch ppc -arch i386'
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=powerpc-apple-darwin8.11.0
ac_cv_host_alias=powerpc-apple-darwin8.11.0
ac_cv_path_install='/usr/bin/install -c'
ac_cv_prog_AWK=awk
ac_cv_prog_ac_ct_CC=gcc
ac_cv_prog_make_make_set=yes
ac_cv_target=powerpc-apple-darwin8.11.0
ac_cv_target_alias=powerpc-apple-darwin8.11.0

##
##
## Output variables. ##
##
##

ACLOCAL='${SHELL} /Users/henningreich/Documents/workspace/odejava_/odejava-jni/build/odejava/odejava-jni/opende/missing --run aclocal-1.9'
ALLOCA=''
AMDEPBACKSLASH=''
AMDEP_FALSE=''
AMDEP_TRUE='#'
AMTAR='${SHELL} /Users/henningreich/Documents/workspace/odejava_/odejava-jni/build/odejava/odejava-jni/opende/missing --run tar'
ARCHFLAGS=''
AUTOCONF='${SHELL} /Users/henningreich/Documents/workspace/odejava_/odejava-jni/build/odejava/odejava-jni/opende/missing --run autoconf'
AUTOHEADER='${SHELL} /Users/henningreich/Documents/workspace/odejava_/odejava-jni/build/odejava/odejava-jni/opende/missing --run autoheader'
AUTOMAKE='${SHELL} /Users/henningreich/Documents/workspace/odejava_/odejava-jni/build/odejava/odejava-jni/opende/missing --run automake-1.9'
AWK='awk'
CC='gcc'
CCDEPMODE=''
CFLAGS='-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk'
CPP=''
CPPFLAGS=''
CXX=''
CXXDEPMODE=''
CXXFLAGS='-arch ppc -arch i386'
CYGPATH_W='echo'
DEFS=''
DEPDIR='.deps'
DRAWSTUFF=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
ENABLE_DEMOS_FALSE=''
ENABLE_DEMOS_TRUE=''
EXEEXT=''
GIMPACT_FALSE=''
GIMPACT_TRUE=''
GL_LIBS=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='${SHELL} $(install_sh) -c -s'
LDFLAGS='-arch ppc -arch i386'
LIBOBJS=''
LIBS=''
LTLIBOBJS=''
MAKEINFO='${SHELL} /Users/henningreich/Documents/workspace/odejava_/odejava-jni/build/odejava/odejava-jni/opende/missing --run makeinfo'
OBJEXT=''
ODE_AGE='0'
ODE_CURRENT='0'
ODE_RELEASE='0.9.0'
ODE_REVISION='9'
ODE_SONAME=''
OPCODE_FALSE=''
OPCODE_TRUE=''
OSX_FALSE=''
OSX_TRUE=''
PACKAGE='ODE'
PACKAGE_BUGREPORT='ode@ode.org'
PACKAGE_NAME='ODE'
PACKAGE_STRING='ODE 0.9.0'
PACKAGE_TARNAME='ode'
PACKAGE_VERSION='0.9.0'
PATH_SEPARATOR=':'
RANLIB=''
SET_MAKE=''
SHARED_LDFLAGS=''
SHELL='/bin/sh'
STRIP=''
TOPDIR=''
TRIMESH_FALSE=''
TRIMESH_TRUE=''
USE_SONAME_FALSE=''
USE_SONAME_TRUE=''
VERSION='0.9.0'
WIN32_FALSE=''
WIN32_TRUE=''
WINDRES=''
X11_FALSE=''
X11_TRUE=''
X86_64_SYSTEM_FALSE=''
X86_64_SYSTEM_TRUE=''
X_CFLAGS=''
X_EXTRA_LIBS=''
X_LIBS=''
X_PRE_LIBS=''
ac_ct_CC='gcc'
ac_ct_CXX=''
ac_ct_RANLIB=''
ac_ct_STRIP=''
ac_ct_WINDRES=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__fastdepCXX_FALSE=''
am__fastdepCXX_TRUE=''
am__include='include'
am__leading_dot='.'
am__quote=''
am__tar='${AMTAR} chof - "$$tardir"'
am__untar='${AMTAR} xf -'
bindir='${exec_prefix}/bin'
build='powerpc-apple-darwin8.11.0'
build_alias=''
build_cpu='powerpc'
build_os='darwin8.11.0'
build_vendor='apple'
datadir='${prefix}/share'
exec_prefix='NONE'
host='powerpc-apple-darwin8.11.0'
host_alias=''
host_cpu='powerpc'
host_os='darwin8.11.0'
host_vendor='apple'
includedir='${prefix}/include'
infodir='${prefix}/info'
install_sh='/Users/henningreich/Documents/workspace/odejava_/odejava-jni/build/odejava/odejava-jni/opende/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localstatedir='${prefix}/var'
mandir='${prefix}/man'
mkdir_p='$(install_sh) -d'
oldincludedir='/usr/include'
prefix='NONE'
program_transform_name='s,x,x,'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
so_ext=''
sysconfdir='${prefix}/etc'
target='powerpc-apple-darwin8.11.0'
target_alias=''
target_cpu='powerpc'
target_os='darwin8.11.0'
target_vendor='apple'

##
##
## confdefs.h. ##
##
##

#define PACKAGE "ODE"
#define PACKAGE_BUGREPORT "ode@ode.org"
#define PACKAGE_NAME "ODE"
#define PACKAGE_STRING "ODE 0.9.0"
#define PACKAGE_TARNAME "ode"
#define PACKAGE_VERSION "0.9.0"
#define VERSION "0.9.0"

configure: exit 77
===============



At this point I decided that I reached my compiling limits and here I am!  :D
A little desperate, a little frustrated ...

Long story short:
What did I do wrong in the first place?
Did I missed something with the installation?
What went wrong with the compiling of the natives for odejava-jni.jar?
Where can I get the right libodejava.jnilib native 0.3.2?

Thank you for your time!
      All solutions to this problem are welcome!
H.a.n.d

First I should note that I don't have a Mac available and neither tested nor compiled the natives myself. But I thought the 0.3.1 osx natives should be universal and thus work for ppc and intel macs. I have seen them running on intel, but probably they fail on ppc?

The build-odejava-jni-osx.sh script should work if you have newer make and autotools installed ("fink" was a buzzword in this regard, no idea what it means, though :P). I have not seen the error you posted before. A common problem is the ode test suite which does not work ootb on osx - just skip it (continue with the script even if tests fail). But you did not get that far, yet.



Anyone else with working ppc binaries out there?

Thank's irrisor you gave me a new view to the problem …  :wink:



Okay guys, I've investigated a little deeper into the problem here is what I've found so far:



First of all I told automake to compile against an i386 architecture (see build-odejava-jni.osx.sh). That is very birdbrained cause I only have an PowerPC.

Only the new Intel Macs are able to compile this architecture and in addition to that they are able to compile for the PowerPC cause they are able to emulate its architecture. This libraries are called fat libraries - they provide more than one processor support.



(build script befor, line 21)

export CXXFLAGS="-arch ppc -arch i386"



(build script after, line 21 )

export CXXFLAGS="-arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk"



Automake compiled fine after this change, untill this error msg:

Compiling odejava natives
In file included from ../generated/c++/odejava.cxx:196:
../src/c/odejava.hpp:33:26: error: joints/joint.h: No such file or directory
compile odejava.cxx failed!



So checked odejava.hpp and looked for the joint.h file which I found in the same dir like the include #include <objects.h> so I changed it to #include <joint.h>.
(Did I changed it right? Maybe I did'nt interpreted this error well?!)

===odejava.hpp===
...

#ifndef odejava_hpp
#define odejava_hpp

#include <ode/ode.h>
#include <objects.h>
#include <joints/joint.h>

#ifdef __cplusplus
extern "C" {
#endif

...



After this change to the odejava.hpp the natives have been compiled without any further error. I replaced the old natives lib in my jME Physics 2 project (libodejava.jnilib) with the new compiled ones.

Finally I didn't got the error message any more that I need the 0.3.2 version, but after the setup of the started test/demo the application crashes with an OS dialoge like before.

Here is the log file of the crash:
Thread 10 crashed, its the thread with the libodejava.jnilib:

Thread 10 Crashed:
0   libodejava.jnilib           0x0a5da4a4 Java_org_odejava_Odejava_spaceCollide2 + 40 (Opcode.cpp:53)
1   <<00000000>>    0x04591264 0 + 72946276
2   <<00000000>>    0x0458a9f0 0 + 72919536
3   <<00000000>>    0x0458aab0 0 + 72919728
4   <<00000000>>    0x0458aab0 0 + 72919728
5   <<00000000>>    0x0458aab0 0 + 72919728
6   <<00000000>>    0x0458aab0 0 + 72919728
7   <<00000000>>    0x0458aab0 0 + 72919728
8   <<00000000>>    0x0458aab0 0 + 72919728
9   <<00000000>>    0x04588164 0 + 72909156
10  libclient.dylib             0x9cfff798 jio_snprintf + 397624
11  libclient.dylib             0x9d00cea4 JVM_StartThread + 2612
12  libclient.dylib             0x9d00cd90 JVM_StartThread + 2336
13  libclient.dylib             0x9d00cd20 JVM_StartThread + 2224
14  libclient.dylib             0x9d00cbdc JVM_StartThread + 1900
15  libclient.dylib             0x9cf97bfc JNI_CreateJavaVM_Impl + 48316
16  libSystem.B.dylib           0x9002bd08 _pthread_body + 96



I also tried diffrent compiling options:

./configure --disable-dependency-tracking --without-tests

./configure --disable-dependency-tracking --without-tests --disable-demos --quiet --enable-trimesh=gimpact --enable-release

./configure --disable-dependency-tracking --without-tests --disable-demos --quiet --enable-trimesh=gimpact --enable-release --disable-debug



Are there any options I must not use for the PowerPC compilation?

Does anyone uses jME 2.0 and jME Physics 2 on a Mac ppc?


A bug in the native code which shows up on ppc only? That's really nasty.



The strange thing is that Opcode.cpp is mentioned but it should not even be used due to --enable-trimesh=gimpact using GIMPACT not OPCODE :?

Did you compile with --enable-trimesh=opcode before producing that vm crash?

Let us go one step back:



Which revision do I have to check out for the compilation?

In my last attempts I used following version (1295):



(build script snippet)

if ! cvs -f -Q -d :pserver:guest:@cvs.dev.java.net:/cvs co odejava; then echo 'cvs checkout failed!'; exit; fi

if ! svn -q co https://opende.svn.sourceforge.net/svnroot/opende/trunk opende -r 1295; then echo 'svn checkout failed!'; exit; fi



(the whole build script)

#!/bin/bash
if [ -d odejava ]; then echo 'odejava directory already exists, this script tries to checkout everything first and thus cannot continue!'; exit; fi
if [ ! -f $JAVA_INCLUDE/jni.h ]; then echo 'JAVA_INCLUDE does not point to the jdks include directory'; exit; fi
if [ ! -d $DEV_SDK ]; then echo 'DEV_SDK should be set to the OSX developer SDK - e.g. /Developer/SDKs/MacOSX10.4u.sdk'; exit; fi
if ! which dos2unix >/dev/null; then echo 'dos2unix tool missing, please make sure dos2unix command is in path'; exit; fi
if ! which automake >/dev/null; then echo 'automake tool missing, please make sure automake version 1.8.2 or higher is in path'; exit; fi
echo 'automake version 1.8.2 or higher is required - found automake - please check version manually:'
automake --version
if ! cvs -f -Q -d :pserver:guest:@cvs.dev.java.net:/cvs co odejava; then echo 'cvs checkout failed!'; exit; fi
if ! cd odejava/odejava-jni/; then echo 'odejava-jni directory does not exist after checkout!'; exit; fi
if ! svn -q co https://opende.svn.sourceforge.net/svnroot/opende/trunk opende -r 1295; then echo 'svn checkout failed!'; exit; fi
if ! cd opende; then echo 'opende directory does not exist after checkout!'; exit; fi
#there are some files with windows line feed - convert them before applying the patch
if ! dos2unix ../src/ode.patch; then
  echo 'dos2unix tool missing (or patch not found), please make sure dos2unix for mac (e.g. via darwinports) command is in path'; exit; fi
find . -name "*.cpp" -exec dos2unix {} ;
sh autogen.sh
export CXXFLAGS="-arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
export CFLAGS=$CXXFLAGS
export LDFLAGS=$CXXFLAGS
echo Running ./configure
if ! ./configure --disable-dependency-tracking --without-tests --enable-trimesh=gimpact;then echo 'opende configure failed!'; exit; fi;
echo Running make for ODE
if ! make -s; then echo 'opende make failed!'; exit; fi
pwd
echo Compiling odejava natives
g++ $CXXFLAGS -fPIC -DHAVE_CONFIG_H -I. -Iinclude/ode -O2 -fno-strict-aliasing -fomit-frame-pointer -ffast-math -Iinclude -Iinclude -IOPCODE -IOPCODE/Ice -I$JAVA_INCLUDE/osx -I$JAVA_INCLUDE -DdTRIMESH_ENABLED -c -o ../bin/odejava_wrap.o ../generated/c++/odejava.cxx
g++ $CXXFLAGS -fPIC -DHAVE_CONFIG_H -I. -Iinclude/ode -O2 -fno-strict-aliasing -fomit-frame-pointer -ffast-math -Iinclude -Iinclude -IOPCODE -IOPCODE/Ice -I$JAVA_INCLUDE/osx -I$JAVA_INCLUDE -DdTRIMESH_ENABLED -c -o ../bin/odejava.o ../src/c/odejava.cpp
g++ $CXXFLAGS -fPIC -dynamiclib `find ode/src -name *.o` ../bin/odejava_wrap.o ../bin/odejava.o -o lib/libodejava.jnilib

echo Removing symbols to get smaller binary
strip lib/libodejava.jnilib



(configuration options)
./configure --disable-dependency-tracking --without-tests --enable-trimesh=gimpact

And I noticed following message while ./configure:

configure: WARNING: unrecognized options: --without-tests, --enable-trimesh
Configuration:
  Target system type:      powerpc-apple-darwin8.11.0
  Build  system type:      powerpc-apple-darwin8.11.0
  Host  system type:      powerpc-apple-darwin8.11.0
  Use double precision:    no
Use OPCODE:              yes
  Use GIMPACT:            no
  Use gyroscopic term:    yes
  Is this a Pentium:      no
  Is the CPU x86-64:      no
  Is this a release build: no
  Adding debug symbols:    yes
  Using SONAME:          no
  Headers will be installed in /usr/local/include/ode
  Libraries will be installed in /usr/local/lib

In your last post you mentioned that OPCODE should not be used but as you can see  it is set by default cause the option --enable-trimesh is not recognized by the config script.

Maybe I try to compile an out of date revision?

executing

svn -q co https://opende.svn.sourceforge.net/svnroot/opende/trunk opende -r 1295
./autogen.sh
./configure --help


gives this result over here

`configure' configures ODE 0.9.0 to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
           [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
           [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR           user executables [EPREFIX/bin]
  --sbindir=DIR          system admin executables [EPREFIX/sbin]
  --libexecdir=DIR       program executables [EPREFIX/libexec]
  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
  --libdir=DIR           object code libraries [EPREFIX/lib]
  --includedir=DIR       C header files [PREFIX/include]
  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
  --datarootdir=DIR      read-only arch.-independent data root [PREFIX/share]
  --datadir=DIR          read-only architecture-independent data [DATAROOTDIR]
  --infodir=DIR          info documentation [DATAROOTDIR/info]
  --localedir=DIR        locale-dependent data [DATAROOTDIR/locale]
  --mandir=DIR           man documentation [DATAROOTDIR/man]
  --docdir=DIR           documentation root [DATAROOTDIR/doc/ode]
  --htmldir=DIR          html documentation [DOCDIR]
  --dvidir=DIR           dvi documentation [DOCDIR]
  --pdfdir=DIR           pdf documentation [DOCDIR]
  --psdir=DIR            ps documentation [DOCDIR]

Program names:
  --program-prefix=PREFIX            prepend PREFIX to installed program names
  --program-suffix=SUFFIX            append SUFFIX to installed program names
  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names

X features:
  --x-includes=DIR    X include files are in DIR
  --x-libraries=DIR   X library files are in DIR

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
  --target=TARGET   configure for building compilers for TARGET [HOST]

Optional Features:
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --disable-dependency-tracking  speeds up one-time build
  --enable-dependency-tracking   do not reject slow dependency extractors
  --enable-soname         Configure ODE shared library to set the soname field
                          on ELF files
  --enable-demos          build tests
  --disable-gyroscopic    Configure ODE to work without gyroscopic term (may
                          improve stability)
  --enable-double-precision
                          Configure ODE to work with double precision, if not
                          specified, single precision is used
  --enable-release        build a release library with -fomit-frame-pointer
                          and -ffast-math
  --enable-debug          Add debug symbols to the library with -g
  --enable-gprof          enable profiling with gprof

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-x                use the X Window System
  --with-arch=arch        build for $arch, where arch is any of the -march
                          flags passed to gcc, without the -march, for example
                          --with-arch=pentium3
  --with-trimesh=opcode|gimpact|none
                          use the specified system for trimesh support.

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor
  XMKMF       Path to xmkmf, Makefile generator for X Window System
  CXX         C++ compiler command
  CXXFLAGS    C++ compiler flags

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

Report bugs to <ode@ode.org>.


And I don't get that warning as well.

As I don't think the configure script acts different on ppc it seems the svn checkout pulled a different revision. Can you doublecheck that the svn really does what it should (getting rev 1295)?

I checked it and I am sure to get the rev. 1295 …



As you can see from your ./configure --help listing, there are no such options:

–without-tests

–enable-trimesh=gimpact



There is a similar option to –enable-trimesh=gimpact, it's –with-trimesh=opcode|gimpact|none.

I guess this is the one to use for the ./configure!



In consideration of all this, are the instructions in the readme.txt (odejava/odejava-jni/src/readme.txt) still valid to compile the natives??



(here is the snippet)

Universal binaries for MacOSX (ppc+intel)



- check you have a recent version of autotools (newest version from fink suits)

- add some additional parameters to the ODE configure call:
export CFLAGS="-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
export CXXFLAGS="-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
./configure --disable-dependency-tracking

- compiling and linking java binaries with adding "-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk":

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/osx -I$JAVA_INCLUDE -DdTRIMESH_ENABLED -c -o ../bin/odejava_wrap.o ../generated/odejava_wrap.cxx

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/osx -I$JAVA_INCLUDE -DdTRIMESH_ENABLED -c -o ../bin/odejava.o ../src/c/odejava.cpp

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.jnilib



What exactly do I need from the opende compilation and from the odejava, to compile the natives for openjava ?
H.a.n.d said:

What exactly do I need from the opende compilation and from the odejava, to compile the natives for openjava ?

The script essentially shows it. What about correcting the script with your newly found parameters?
  1. I checked out opende rev. 1295 (svn)
  2. I checked out odejava (cvs)



    (I needed to change the #include <joints/joint.h> to #include <joint.h> in the odejava.hpp.)


  3. I used following build script (this time with OPCODE):

#!/bin/bash
if [ ! -f $JAVA_INCLUDE/jni.h ]; then echo 'JAVA_INCLUDE does not point to the jdks include directory'; exit; fi
if ! which dos2unix >/dev/null; then echo 'dos2unix tool missing, please make sure dos2unix command is in path'; exit; fi
if ! which automake >/dev/null; then echo 'automake tool missing, please make sure automake version 1.8.2 or higher is in path'; exit; fi
echo 'automake version 1.8.2 or higher is required - found automake - please check version manually:'
automake --version
if ! cd opende; then echo 'opende directory does not exist after checkout!'; exit; fi
#there are some files with windows line feed - convert them before applying the patch
if ! dos2unix ../src/ode.patch; then
  echo 'dos2unix tool missing (or patch not found), please make sure dos2unix for mac (e.g. via darwinports) command is in path'; exit; fi
find . -name "*.cpp" -exec dos2unix {} ;
sh autogen.sh
export CXXFLAGS="-arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
export CFLAGS=$CXXFLAGS
export LDFLAGS=$CXXFLAGS
echo Running ./configure
if ! ./configure --disable-dependency-tracking --with-trimesh=opcode --enable-release;then echo 'opende configure failed!'; exit; fi;
echo Running make for ODE
if ! make -s; then echo 'opende make failed!'; exit; fi
cd ../src
echo Compiling odejava natives
if ! g++ $CFLAGS -fPIC -DHAVE_CONFIG_H -I../src/c -I../opende/include -I../opende/ode/src -O2
     -fno-strict-aliasing -fomit-frame-pointer -ffast-math -Iinclude -IOPCODE -IOPCODE/Ice
     -I$JAVA_INCLUDE/osx -I$JAVA_INCLUDE -DdTRIMESH_ENABLED -c -o ../bin/odejava_wrap.o
     ../generated/c++/odejava.cxx
     then echo 'compile odejava.cxx failed!'; exit; fi
if ! g++ $CFLAGS -fPIC -DHAVE_CONFIG_H -I../src/c -I../opende/include -I../opende/ode/src -O2
     -fno-strict-aliasing -fomit-frame-pointer -ffast-math -Iinclude -IOPCODE -IOPCODE/Ice
     -I$JAVA_INCLUDE/osx -I$JAVA_INCLUDE -DdTRIMESH_ENABLED -c -o ../bin/odejava.o
     ../src/c/odejava.cpp
     then echo 'compile odejava.cpp failed!'; exit; fi
echo Linking odejava and ODE into library
if ! g++ $CFLAGS -dynamiclib -fPIC `find ../opende/ode/src -name *.o`
     ../bin/odejava_wrap.o ../bin/odejava.o -o ../bin/libodejava.jnilib
     then echo 'linking library failed!'; exit; fi
if ! cp ../bin/libodejava.jnilib ../../..; then echo 'failed to copy library to top level directory'; exit; fi
cd ../../..
echo Removing symbols to get smaller binary
strip libodejava.jnilib



Shell output: (please see the attached .txt)

I could not resolve this, it's over my progamming skilles, so no natives with OPCODE!

4. I compiled it with GIMPACT (I used the same build script except with the option --with-trimesh=gimpact).

Shell output: (please see the attached .txt)

Now the natives were compiled. I build the odejava.jar with the build.xml and copied the .jar and the compiled libodejava.jnilib into the latest checkout from jME Physics 2.

I've got the same OS crash while running a test/demo like the time before.  :(

Are the g++ compile commands right?
Do you like to have my checked out project to see if the revision is the correct one?

One thing you could try is to omit the line "strip libodejava.jnilib". But that's most likely not the problem.



One would need to debug that stuff with a C debugger. No idea what's going wrong on ppc, sorry. :expressionless:

So I spent about 8 hours wrestling with my Intel MacBook Pro and building odejava natives. Talk about a painful process. After installing all the little accessory tools needed for the build process, by trial and error I was finally able to spit out a jnilib at the end. I still need to test it, but this is what I had to do…



Steps needed to successfully build the odejava OS X (10.5.5) native library.


  1. Make sure the JAVA_INCLUDE variable is set:

    export JAVA_INCLUDE="/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Headers"


  2. Change the build-odejava-jni-osx.sh script to use the proper flags when calling configure:

    if ! ./configure --enable-dependency-tracking=no --enable-demos=no --with-trimesh=gimpact --enable-release=yes --enable-debug=no;



    Somewhere along the way, OpenDE changed the config script and odejava didn't keep up.


  3. Now execute the build-odejava-jni-osx.sh script. It takes a while… It WILL fail, but you need the sources that it checks out from cvs and svn at the beginning.


  4. Next you'll need to fix a compile error in odejava/odejava-jni/opende/GIMPACT/src/gim_memory.cpp by replacing the malloc.h include with this:

    #if !defined(APPLE)

    // malloc.h deprecated on apple

    #include <malloc.h>

    #endif



    This is because malloc is a part of the stdlib in OS X, and malloc.h does not exist.


  5. To avoid a LD cycle error during Make, put this in the terminal:

    export LDFLAGS="-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"


  6. Now change the #include <joints/joint.h> to #include <joint.h> in odejava/odejava-jni/src/c/odejava.hpp



    So far so good…


  7. Now picking up where the script first failed, you have to manually run 'configure' from the opende directory using the above flags. I also had to manually execute line-by-line the remainder of build-odejava-jni-osx.sh, for whatever reason, but this is the only way for everything to work.



    Sucks doesn't it?



    But it works. This weekend I will also build linux 32 natives, and if I'm really ambitious I might get a chance to get linux 64 natives built. When all is said and done, we should be able to use the newer odejava (0.3.2) with jME Physics 2. Also, if someone out there with Windows x64 and VS 2005 would build that dll, we would be golden.  8)

Wow, quite the endeavor there nymon; I didn't even know it needed doing :confused:



So, I guess everyone is using 0.3.1 right now? Cuase I am on Intel MacBook also with no issues…



Good work :), what does 0.3.2 get us??

Not sure what the changes are, but I don't think they would be bad! Irrisor might know.



My motivation for the move to the latest version is a change in how odejava loads its natives. Irrisor was kind enough to put a patch in for me. But before jME Physics can use the latest odejava jar (with my change), we need to build all the natives to go with it. It currently only has a win32 dll.  :expressionless:

well, unfortunately my 'nix skills are not what they should be anymore (although if need by I think I could get it done); anyone else think they are more equipped?

I'm working on linux 32 now. Are you setup for linux 64?

nope :frowning:



my macbook is a core duo…

not me…



thats GREAT news though :slight_smile:

Ok, I’ve assembled a new odejava-jni.jar and native library collection for ODEjava 0.3.2. I’ve tested on Windows XP (32), Ubuntu linux (32), and an Intel Mac. I only need a volunteer with a PPC Mac to run a couple jME Physics test. You only need to download the zip below and extract the contents into your jME Physics 2implodelib overwriting whats there.



----> ODEjava 0.3.2 library for jME Physics 2



Please report back as soon as its been tested.

If you don't get an offer in the next day or 2 I would just commit it, PPC users are getting more and more scarce every day…



Nice Work nymon :slight_smile:

nymon said:

Ok, I've assembled a new odejava-jni.jar and native library collection for ODEjava 0.3.2. I've tested on Windows XP (32), Ubuntu linux (32), and an Intel Mac. I only need a volunteer with a PPC Mac to run a couple jME Physics test. You only need to download the zip below and extract the contents into your jME Physics 2implodelib overwriting whats there.

----> ODEjava 0.3.2 library for jME Physics 2

Please report back as soon as its been tested.


HI!

I wanted to ask you if this version of ODE has the assertions disabled. Because I am running a version (I don't know which one :P) that asserts when, for example, has problems with the math, and my application quits immediatly.

Thx :)