1、准备
https://www.python.org/ 官网上下载最新的Python-2.7.15.tgz
由于需要zlib和sqlite3因此分别去官网下载
sqlite-autoconf-3250300.tar.gz
zlib-1.2.1.2.tar.gz
2、编译sqlite3
cd sqlite-autoconf-3250300
./configure --host=mips64el-linux --build=x86_64-redhat-linux --prefix=/home/chentao/work/project/Z2-KERNEL-t/rootfs/rootfs_fs/fsxxx/usr
make
make install
其中:--prefix=xxx为指定编译完成安装路径,一般为制作的根文件系统的usr目录下
3、编译zlib
由于zlib编译不支持--host的方式指定交叉编译。
CC=mips64el-linux-gcc ./confiure --shared --prefix=/home/chentao/work/project/Z2-KERNEL-t/rootfs/rootfs_fs/fsxxx/usr
make
mak install
4、编译python
由于mips环境运行的时候 import ctypes会出现问题,提示未实现某函数这里需要修改模块编译
diff -r 656543a2ad75 Modules/_ctypes/libffi/fficonfig.py.in
--- a/Modules/_ctypes/libffi/fficonfig.py.in Mon Mar 02 23:32:02 2015 -080