1.download Python-2.7.2 and Python-2.7.2-xcompile.patch
其他patch
2.解压Python-2.7.2.tgz
3.进到目录里 ./configure
4.make python Parser/pgen
5.mv python hostpython
6.mv Parser/pgen Parser/hostpgen
7.make distclean
//如果clean失败,则拷贝出以上两个备份,重新解压代码,再进行下面
8.patch -p1 < Python-2.7.2-xcompile.patch
9.CC=arm-linux-gcc CXX=arm-linux-g++ AR=arm-linux-ar RANLIB=arm-linux-ranlib ./configure --host=arm-linux --build=x86_64-linux-gnu --prefix=`pwd`/_install
10.make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen BLDSHARED="arm-linux-gcc -shared" CROSS_COMPILE=arm-linux- CROSS_COMPILE_TARGET=yes HOSTARCH=arm-linux BUILDARCH=x86_64-linux-gnu
11.make install HOSTPYTHON=./hostpython BLDSHARED="arm-linux-gcc -shared" CROSS_COMPILE=arm-linux- CROSS_COMPILE_TARGET=yes prefix=`pwd`/_install
错误:
exit 77 configure: error: C compiler cannot create executables
交叉编译工具链有问题,换一个即可
In file included from build/temp.linux-x86_64-2.7/libffi/include/ffi.h:64,
from /home/chengyake/download/Python-2.7.2/Modules/_ctypes/_ctypes.c:112:
build/temp.linux-x86_64-2.7/libffi/include/ffitarget.h:88: error: 'FFI_DEFAULT_ABI' undeclared here (not in a function)
...
host 和 build 搞反了
重申:
host即一般arm
build:一般x86