龙芯python交叉编译

 http://www.openloongson.org/forum.php?mod=viewthread&tid=119#lastpost

吐个槽:龙芯1.0板子的2.0针距母口实在是没法接我现有的各种外设。只能玩玩了
大多数xx派程序都是python的,有了python应该可以直接移植一大堆东西了。
网上大多数python交叉编译的教程不太适合最新版本。我改了一下做了一个能用的编译脚本

 make_mips_python.zip (491 Bytes, 下载次数: 17) 

适合最新的2.7.10版,应该也能用在最新的3.6.x上。python2.7.10下载地址:
https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tar.xz

#1 编译
a. 先检查所需的库,直接跳到b开始编译也能成功。但是运行代码的时候可能缺这少那
运行时如果提示缺少_collections或者其他库,需要修改源代码中Python2.7.10/Modules/Setup.dist文件
找到对应的库然后取消注释
其中shared最好编译,其他的看需求打开一些。
array arraymodule.c        # array objects
cmath cmathmodule.c _math.c # -lm # complex math library functions
math mathmodule.c _math.c # -lm # math library functions, e.g. sin()
_struct _struct.c        # binary structure packing/unpacking
time timemodule.c # -lm # time operations and variables
operator operator.c        # operator.add() and similar goodies
#_testcapi _testcapimodule.c    # Python C API test module 要关闭否则编译不过
_random _randommodule.c        # Random number generator
_collections _collectionsmodule.c # Container types
_heapq _heapqmodule.c                # Heapq type
itertools itertoolsmodule.c        # Functions creating iterators for efficient looping 
strop stropmodule.c                # String manipulations
_functools _functoolsmodule.c        # Tools for working with functions and callable objects
_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c        # elementtree accelerator
#_pickle _pickle.c        # pickle accelerator
datetime datetimemodule.c        # date/time type
_bisect _bisectmodule.c        # Bisection algorithms

b. 解压以后把make_mips_python.shell拷贝进去执行,需要跑几分钟最后会有一个error,不用管
生成的python在 ./mips_python/install/
bin和lib都要拷贝进开发板
mkdir /usr/libmkdir /usr/bin

1.png

附:龙芯Intellij IDEA开发Spring web应用视频 

http://tieba.baidu.com/p/5975179608

#2 安装
cp /mnt/usb/mips_python/bin/python2.7 /usr/bin/
cp -r /mnt/usb/mips_python/lib/python2.7 /usr/lib/
export PYTHONHOME=/usr/
再创建文件链接 ln -s /usr/bin/python2.7 /usr/bin/python

增加python库的数量,还有静态编译,减小体积之类就交给你们了。

猜你喜欢

转载自blog.csdn.net/weixin_40065369/article/details/86686980