Comment 6 for bug 303759

Revision history for this message
Ethan Glasser-Camp (ethan-glasser-camp) wrote :

Thanks. The numbers are different from what they were in the old version of ODE, but never mind. Now I'm trying to build a python extension using Pyrex and hitting similar errors. I modified setup.py to include the ode-config calls that you have, above, and easy_install seems to be compiling correctly:

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wall -g -O2 -O0 -fPIC -I/usr/include -I/usr/local/include -I/opt/local/include -I/usr/include/python2.5 -c ode_trimesh.c -o build/temp.linux-i686-2.5/ode_trimesh.o -I/usr/include -DdDOUBLE
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wall -g -O2 -O0 build/temp.linux-i686-2.5/ode_trimesh.o -L/usr/local/lib -L/opt/local/lib -lode -lstdc++ -o build/lib.linux-i686-2.5/ode.so -L/usr/lib -lode

But when I import this module and call setSphere in the same way, I still get

ODE Message 2: mass must be > 0 in dMassCheck() File mass.cpp Line 49

with random mass values in the results. Trying to track this down, I started to grovel in the generated source code (ode_trimesh.c). If I print the values of the arguments that are getting sent to dMassSetSphere, they look right -- 2500.0, 0.05. Strangely enough, if I print *before* the call to dMassSetSphere, the error goes away. If I print *after*, the error is still there.

I rebuilt ode with debugging symbols, and pyode with my modifications. Check this fascinating gdb transcript:

Breakpoint 1, dMassSetSphere (m=0xb7cf0f78, density=2.0463635885232469e-13, radius=-0.12512883157955856) at mass.cpp:121
121 radius*radius*radius * density), radius);
Current language: auto; currently c++
(gdb) print radius
$1 = -0.12512883157955856
(gdb) print density
$2 = 2.0463635885232469e-13
(gdb) up
#1 0xb7b0c6fb in __pyx_f_3ode_4Mass_setSphere (__pyx_v_self=0xb7cf0f70, __pyx_args=0xb7cc414c, __pyx_kwds=0x0) at ode_trimesh.c:567
567 dMassSetSphere(m, 2500.0, 0.05);
Current language: auto; currently c

The only thing that seems odd about this is the change of languages. I tried rebuilding python-pyode using g++, but I get a ton of compilation errors. Thoughts?

Ethan