[ODE] Build of UNSTABLE fails on AMD-64

Peter Onion Peter.Onion at btinternet.com
Fri Dec 2 14:24:52 MST 2005


I just tried to build ode UNSTABLE on my new AMD_64 SuSE 10.0 machine.
There are two problems....

FIRST PROBLEM

g++ -I../../include -I../../include   -g   -o libode.so -shared
obstack.o collision_util.o array.o ode.o error.o odemath.o
collision_kernel.o export-dif.o quickstep.o collision_quadtreespace.o
rotation.o collision_space.o collision_std.o joint.o
step.o collision_transform.o lcp.o stepfast.o mass.o testing.o mat.o
timer.o matrix.o util.o memory.o misc.o fastldlt.o fastltsolve.o
fastdot.o fastlsolve.o   -lstdc++ -lm -lpthread
/usr/lib64/gcc/x86_64-suse-linux/4.0.2/../../../../x86_64-suse-linux/bin/ld: obstack.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
obstack.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [libode.so] Error 1


As gcc helpfully pointed out the addition of "-fPIC" to the flags in the
Makefile.am in the ode src directory fixed it....

SECOND PROBLEM
if g++ -DHAVE_CONFIG_H -I. -I. -I../../include/ode   -g -g
-I../../include -I../../include -g -MT test_space.o -MD -MP -MF
".deps/test_space.Tpo" -c -o test_space.o test_space.cpp; \
then mv -f ".deps/test_space.Tpo" ".deps/test_space.Po"; else rm -f
".deps/test_space.Tpo"; exit 1; fi
test_space.cpp: In function ‘void nearCallback(void*, dxGeom*,
dxGeom*)’:
test_space.cpp:127: error: cast from ‘void*’ to ‘int’ loses precision
test_space.cpp:128: error: cast from ‘void*’ to ‘int’ loses precision
make[2]: *** [test_space.o] Error 1


The code in question is

 124 static void nearCallback (void *data, dGeomID o1, dGeomID o2)
    125 {
    126   int i,j;
    127   i = (int) dGeomGetData (o1);
    128   j = (int) dGeomGetData (o2);
    129   if (i==j)
    130     printf ("collision (%d,%d) is between the same object
\n",i,j);
    131   if (!good_matrix[i][j] || !good_matrix[j][i])
    132     printf ("collision (%d,%d) is incorrect\n",i,j);
    133   if (test_matrix[i][j] || test_matrix[j][i])
    134     printf ("collision (%d,%d) reported more than once\n",i,j);
    135   test_matrix[i][j] = 1;
    136   test_matrix[j][i] = 1;
    137 }

Since pointers and ints are nolonger the same size on AMD_64s this won't
work anymore....  The pointers will either have to be used to actually
point at something, or cast them to a long (OK until we all have 128 bit
machines !).

Peter




More information about the ODE mailing list