python - Cython Help: Skipping Incompatible Library -
i have small cython module called delorean.pyx
cdef public struct vehicle: int speed float power cdef public api void activate(int v): print "time travel achieved @ " + str(v) + " mph."
i have setup.py file looks this:
from distutils.core import setup cython.build import cythonize setup(name = 'first try', ext_modules = cythonize(["delorean.pyx"]),)
when go compile cython code using this: cython delorean.pyx
this generate *.h, *.c, , *_api.h files.
i have c program called marty.c looks this:
#include "python.h" #include "delorean_api.h" #include <stdlib.h> struct vehicle car; int main(int argc, char** agrv){ printf("hello"); py_initialize(); import_delorean(); car.speed = 33; car.power = 12.3; printf("speed: %d, power: %f", car.speed, car.power); activate(12); py_finalize(); return 0; }
i compile entire module using this:
gcc -fpic -l/usr/lib -i/usr/local/include/python2.7 -lpython2.7 delorean.c marty.c -o delorean -g
this compiles these notes:
/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching -lc
/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching -lc
this creates a.out file; however, seg faults when run.
when run in gdb, output:
(gdb) r starting program: /root/asta/cython-0.22.1/delorean [thread debugging using libthread_db enabled] using host libthread_db library "/lib64/libthread_db.so.1". program received signal sigsegv, segmentation fault. 0x0000000000000000 in ?? () (gdb)
i have played around marty.c , have narrowed down culprit when activate() function called. there have overlooked? possible causing behavior?
Comments
Post a Comment