Crosscompiling Python

I'd like to be able to cross-compile Python and its extensions. This page is where I'm collecting notes on the subject.

I have noticed that there's a big gotcha: you have to use the exact same sources for Python for the build system and for the target, because the python scripts used to build python (gawd, that's sick) relentlessly refer to the build system's copy of the Python library, even if you try to use a different one. Thus any patches to distlib will be almost completely ignored unless they are also patched in the build system Python library. Thus you really do seem to have to build Python once for the build system immediately before building it for the target. Maybe this will change once a version of the cross-compilation patch makes it into the main python tree.

Another huge issue is that you have to keep and friends from searching /usr and /usr/local for libraries to wrap. Of the patches below, only gentoo's seems to do this.


All of these seem to contribute something new; it would probably be good to combine them all into a best-of-breed crosscompilation patch for Python.