问题
There are several tutorials on the web documenting how to cross-compile or cross-build Python for various embedded systems using some basic hacking and patching, like so:
http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html
This worked well for me in the past, when I was using Python 2.7.2.
In Python 2.7.4, some cross-compile functionality was finally included in the upstream build process, documented here:
- http://bugs.python.org/issue17086
- https://mail.python.org/pipermail/python-dev/2013-February/123779.html
This breaks all of the previous cross-build hacks, and I cannot find any updated tutorials or documentation for the new built-in cross-compile procedure.
Does anyone have a good example or documentation on using the new cross-compile procedure for Python 2.7.4 and onward in the 2.7 branch?
Thanks!
回答1:
After diving into the existing patches and changes, I was able to produce a modified patch set that utilizes the latest cross-compiling features for 2.7.5.
http://www.trevorbowen.com/2013/10/07/cross-compiling-python-2-7-5-for-embedded-linux/
Paul also references it on his original "classic" cross-compile-Python post:
http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html
HTH
回答2:
For posterity...
Though the question is specifically about Python 2.7, if you're willing to step up to Python3, another option for embedded/micro with good cross-compiling features/support is Micro Python; (see also June 2014 announcement though it was around before that).
See also this other SO thread about small/portable (in multiple senses) Python implementations.
来源:https://stackoverflow.com/questions/19120938/cross-compiling-python-2-7-4