0
votes

I want to cross compile custom python with riscv64-unknown-linux-gnu-gcc from riscv-tools. I've tried to cross-compile Python-2.7.9 patched by riscv-poky, and gotten the error below:

configure: error: "libffi has not been ported to riscv64-unknown-linux-gnu."
Failed to configure _ctypes module

Can anyone help this problem?

1

1 Answers

0
votes

Cross-compiling Python outside of riscv-poky can be a bit tricky. By default, Python is built with its own copy of libffi that is bundled with the source distribution (in Modules/_ctypes/libffi). When building within poky, this libffi is overridden by the system's libffi (using the --with-system-ffi flag), which includes our libffi RISC-V port from this recipe:

https://github.com/riscv/riscv-poky/blob/master/meta-riscv/recipes-gnome/libffi/libffi_3.1.bb

It is likely that your build is trying to use the libffi that comes bundled with Python. The easiest solution might be to build Python within poky. However, if that is not an option, I would try to apply the libffi patch manually and see whether that solves the problem.