ocamlc -c -cc "gcc -static -O3 -std=gnu99 -ffast-math -o wrap_chipmunk.o" wrap_chipmunk.c
ocamlmklib \
-L/usr/local/ -L/usr/local/lib \
-o _chipmunk_stubs wrap_chipmunk.o \
-ccopt -O3 -ccopt -std=gnu99 -ccopt -ffast-math \
-lchipmunk -lchipmunk_static
/usr/bin/ld: wrap_chipmunk.o: relocation R_X86_64_32 against `a local symbol'
can not be used when making a shared object; recompile with -fPIC
wrap_chipmunk.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [dll_chipmunk_stubs.so] Error 2
Does someone know how to manage these kind of problems ?
Well, I suppose that if he had problems with chipmunk itself he would have given the related errors...
so I suppose it is a problem related to the wrapper, but I'm not very experienced with C, and moreover not with those 64-bit machines
Just met some problems compiling ruby extensions for rev.144 on Ubuntu Linux x64 ( see output below ).
Adding -fPIC complier flag does the trick :
./CMakeLists.txt:set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -fPIC") # allways use gnu99
though either way I get tons of warnings like
/home/tsvigun/devenv/chipmunk/errdemo/trunk/src/cpCollision.c: In function ‘findVerts’:
/home/tsvigun/devenv/chipmunk/errdemo/trunk/src/cpCollision.c:174: warning: cast from pointer to integer of different size
/home/tsvigun/devenv/chipmunk/errdemo/trunk/src/cpCollision.c:180: warning: cast from pointer to integer of different size
Do I miss something? Not that it is a real problem, binding library built this way works ok, just a bit worried.
$ svn checkout http://chipmunk-physics.googlecode.com/svn/trunk/
...
A trunk/docsrc/makedocs.rb
U trunk
Checked out revision 144.
...
$ cd ./trunk/
$ cmake -D BUILD_RUBY_EXT=ON -DRUBY_INCLUDE_PATH=/usr/include/ruby-1.9.0 .
...
-- Build files have been written to: /home/tsvigun/devenv/chipmunk/errdemo/trunk
$ make
...
Linking C shared module chipmunk.so
/usr/bin/ld: ../src/libchipmunk.a(chipmunk.c.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
../src/libchipmunk.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [ruby/chipmunk.so] Error 1
make[1]: *** [ruby/CMakeFiles/ruby_ext.dir/all] Error 2
make: *** [all] Error 2