<< return to Pixycam.com

Cross-compiling Python APIs for Beaglebone Black?

I am trying to get the Python APIs running on a Beaglebone Black. The Beaglebone I have is running a custom Linux flavor and does not have network access, so I can’t simply install swig and compile directly on the Beaglebone. Instead, I have a toolchain on my host computer I’m trying to use to cross-compile for the Beaglebone Black. I was able to use this toolchain to cross-compile the C++ demos and run them successfully on the Beaglebone, but now I’m having trouble compiling the Python demos. After modifying swig.dat and running build_python_demos.sh, I get the following error:

In file included from /usr/include/python3.6m/Python.h:8:0,
                 from pixy_wrap.cxx:173:
/usr/include/python3.6m/pyconfig.h:13:12: fatal error: arm-linux-gnueabihf/python3.6m/pyconfig.h: No such file or directory
 #  include <arm-linux-gnueabihf/python3.6m/pyconfig.h>

Has anyone had success with using swig to cross-compile?

Hello,
That’s an interesting error because it’s coming from Python.h. I’m not sure what’s going on (sorry!)

Edward

Following up on this – I realized the problem was that my toolchain was including the wrong Python header files during compilation. It was including the headers for my native Python, not the headers for my target Python. Thus it couldn’t find <arm-linux-gnueabihf/python3.6m/pyconfig.h> because it thought it was still compiling for my x86 machine. I fixed this by using crossenv to include the correct Python headers in the build process.

1 Like

Nice detective work! And thanks so much for circling back to provide the solution! Hope this helps any other users with similar issues.