移植python到imx6

来源:互联网 发布:移动数据流量叠加卡 编辑:程序博客网 时间:2024/04/30 17:53

参考网站:

移植sqlite:

http://www.cnblogs.com/hit-python/articles/4081673.html


移植python-2.7.3

http://www.cnblogs.com/hit-python/articles/4079506.html


python-2.7.3的patch

http://download.csdn.net/download/lgz00gi/9092051


1.下载解压python-2.7.3

$tar -xvf Python-2.7.3.tar.bz2


2.配置编译编译X86平台的python

 $./configure


$make python Parser/pgen


将生成的PC版移动至hostpython将生成的PC版移动至hostpython

$ mv python hostpython


将生成的PC版解释器移动至Parser/hostpgen

$ mv Parser/pgen Parser/hostpgen


清除不必要的文件

 make distclean


3.先将补丁打上:

在pyton-2.7.3目录下面执行打补丁命令

patch -p1 < Python-2.7.3-xcompile.patch


4.设置交叉编译器

CC=arm-fsl-linux-gnueabi-gcc


5设置C++交叉编译器

C++=arm-fsl-linux-gnueabi-gc++


6.设置AR 

AR=arm-fsl-linux-gnueabi-ar


7设置RANLIB

RANLIB=arm-fsl-linux-gnueabi-ranlib


8.配置生成arm版本的makefile

./configure --host=arm-fsl-linux-gnueabi --prefix=.tmp_output目录


9.编译

make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen BLDSHARED="arm-fsl-linux-gnueabi-gcc -shared" CROSS_COMPILE=arm-fsl-linux-gnueabi- CROSS_COMPILE_TARGET=yes



10.安装到tmp_output目录

make install HOSTPYTHON=./hostpython BLDSHARED="arm-fsl-linux-gnueabi-gcc -shared" CROSS_COMPILE=arm-fsl-linux-gnueabi- CROSS_COMPILE_TARGET=yes



如果成功之后,会在tmp_output目录生成bin lib, include 等目录,将目录放到根文件系统里面去,执行bin下面的python