How can I put my cross-compiled libffi somewhere micropython unix port will find it? #13012
-
Related to: Hello, I am trying to cross-compile to an arm-linux-gnueabihf host from x86_64-linux PC. I used these steps: cd micropython/mpy-cross
make
cd ../ports/unix
make submodules
make CROSS_COMPILE=arm-linux-gnueabihf- Which generates this error: modffi.c:40:10: fatal error: ffi.h: No such file or directory
#include <ffi.h> I found this discussion on the old forum archive related to this error: I followed the work around of providing However, this can lead to issues because now libraries that are called through libffi do not work. So following the advice of the forum user dhylands: I cross-compiled libffi with these steps: git clone https://github.com/libffi/libffi.git
cd libffi
./autogen.sh
./configure CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ -host=arm-linux -build=x86_64-linux -prefix=/home/jivey/Devel/state_machine/install_files -disable-dtrace -disable-systemtap -disable-selinux
sudo cp arm-unknown-linux-gnu/include/ffi.h /usr/include
sudo cp arm-unknown-linux-gnu/include/ffitarget.h /usr/include
sudo cp arm-unknown-linux-gnu/fficonfig.h /usr/include
cp -r arm-unknown-linux-gnu/ ../micropython/lib/libffi However, this did not work because make could not find libffi.h still after these steps. What am I doing wrong or where should I copy these files so make will see them while cross-compiling? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
One option is to do Otherwise look at ports/unix/Makefile and you might be able to adapt the handling of MICROPY_STANDALONE to work with your locally built copy. |
Beta Was this translation helpful? Give feedback.
@JiveyGuy
One option is to do
make MICROPY_STANDALONE=1
which will use a locally built copy of libffi from a submodule and set the appropriate compiler flags to use that. (You may need to update the submodule to a more recent version if you run into issues).Otherwise look at ports/unix/Makefile and you might be able to adapt the handling of MICROPY_STANDALONE to work with your locally built copy.