Hi Sarvi,
On Tue, Aug 14, 2012 at 12:36 AM, Sarvi Shanmugham <
sarv...@gmail.com> wrote:
> Here is how I would normally Cross compile another python extension written
> in C
> $(CROSS_CC) -I$(CROSS_PYTHON_INC_DIR) -o samplepyext.o -c samplepyext.c
> $(CROSS_CC) -o samplepyext.so -L$(CROSS_PYTHON_LIB_DIR)
> -lpython$(CROSSPY_VER) samplepyext.o
Ok, so directly by calling the compiler and not with e.g. a setup.py .
Yes, you can do that with CFFI too.
- first kill the __pycache__ directory completely
- import the module that contains "ffi.verify()" on the host x86
- it will create for you one file __pycache__/_cffi_x*.c and compile
it into __pycache__/_cffi_x*.so.
Then if an .so with the same name is available on the MIPS for
importing, then ffi.verify() will import it directly without
recompiling anything. So use the $(CROSS_CC) lines above to
cross-compile __pycache__/_cffi_x*.c into _cffi_x*.so, but put the
result *outside* the __pycache__ file in a place along the PYTHONPATH
(e.g. in the current directory).
A bientôt,
Armin.