python3.4交叉编译与移植

学习Python已经有些念头,不过一直都是在PC上面编程,现在正好有项目需要在ARM中使用Pyhon,可以将Python发扬光大。以下记录交叉编译与移植的具体步骤。

首先在https://www.python.org下载Pyhon3.4.3的源码

1、此编译环境是,Ubuntu 14.04 交叉编译版本采用的是arm-linux-gnueabihf 4.7版本

2、mkdir ~/work

cd ~/work

下载代码后解压缩 tar xvf Python-3.4.3.tgz

3、编辑Modules/Setup文件,将其中需要集成的内部模块注释去掉

我主要保留了_csv,posix,errno,pwd,_sre,_codecs,_weakref,_functools,_operator,_collections,itertools,atexit,_stat,_locale,_io,zipimport,faulthandler,_tracemalloc,_symtable,array,cmath,math,_struct,time,_weakref,_random,_pickle,_datetime,_bisect,_heapq,_csv,_socket,_md5,_sha1,_sha256,_sha512,binascii,parser,_multibytecodec,_codecs_cn

首先要交叉编译zlib,如何编译可以参考google,再将libz.a , zconf.h , zlib.h拷贝到arm编译起的lib目录与include目录(此方法不合适,肯定有更合适的)

4、echo ac_cv_file__dev_ptmx=no > config.site

echo ac_cv_file__dev_ptc=no >> config.site

export CONFIG_SITE=config.site

./configure CC=arm-linux-gnueabihf-gcc CXX=arm-

你可能感兴趣的:(python3.4交叉编译与移植)