您的位置 首页 报告

python移植到arm渠道

1.交叉编译Python见CrossCompilingPythonforEmbeddedLinuxCC=arm-linux-gccCXX=arm-linux-g++AR=arm-linux-arRAN

1. 穿插编译Python

  见Cross Compiling Python for Embedded Linux

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=/root/tftpboot/Python-2.7.3make 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-gnumake install HOSTPYTHON=./hostpython BLDSHARED="arm-linux-gcc -shared" CROSS_COMPILE=arm-linux- CROSS_COMPILE_TARGET=yes prefix=/root/tftpboot/Python-2.7.3

2. PC与开发板文件传输

  tftp: tftp -l path/to/filename -r filename -g 192.168.*.*

3. 文件复制

  •   cp /your/path/bin/python2.7 /bin/python

or export PATH=/your/path/bin/:$PATH # OK210开发板会报错

  • 复制serial、django等python库复制到/lib/python2.7/site-packages/目录下。

4. 设置Python相关环境变量

  以Python2.7.x为例。

export PYTHONHOME=/your/path/#export PYTHONPATH=$PYTHONHOME:$PYTHONHOME/lib/python2.7:$PYTHONHOME/lib:$PYTHONHOME/lib/python2.7/site-packages#export PATH=$PATH:$PYTHONHOME:$PYTHONPATH

5. sqlite3

Building SQLLite and other dependanciesThanks to Lothsahn’s 2.7.3 patch, it is now possible to build sqlite3, bz2, gz, ssl and ctypes.  Lothsahn provides the following instructions:To do the compilation, the dependencies must be in the include and lib folder one path up from the python install.   For example:/include <– header files go here/lib <– shared object files go here/Python-2.7.3 <—Python sources go here during compileDependencies include libffi, sqlite, openssl, bzip2, zlib, etc.

1. 依照上面Paul Gibson给的Cross Compiling Python for Embedded Linux, 可是import sqlite3会报错,原因暂不明。

试了一些解决办法,测验未果,可能是lib_dir途径问题:

  •   Removing other search paths from the setup.py, but the one i had the ARM compiled library in, made it work. 测验也未经过。

http://stackoverflow.com/questions/12385634/shared-library-sqlite3-so-not-found-when-importing-sqlite3-on-python-2-6-6

  •   http://stackoverflow.com/questions/10654707/no-module-named-zlib-found
  •   http://stackoverflow.com/questions/6171210/building-python-and-more-on-missing-modules

3.debian渠道成功。 http://www.friendlyarm.net/forum/topic/2731

参阅:

1. cross compile python, busybox, flex, bash and so on,ARM cross-compiling howto

2. 网上一个给力的比如,python-2.6.6:

ClickandrunpythoncrosscompilingforEmbeddedARMLinux

3.在友善之臂Linux体系中运用pythonhttp://112.124.9.243/?p=285

4.移植python3到ARM渠道的OK6410开发板http://www.51bigfool.com/%E7%A7%BB%E6%A4%8Dpython3%E5%88%B0arm%E5%B9%B3%E5%8F%B0%E7%9A%84ok6410%E5%BC%80%E5%8F%91%E6%9D%BF.html

附:

  •  用strip处理往后,将去掉其间的调试信息,履行文件巨细也将小许多。指令如下:

    #arm-linux-strip file

    其间file是用arm-liunux-gcc编译生成的二进制文件。
  • ./configure--host=arm-linux CC=arm-linux-gcc AR=arm-linux-ar STRIP=arm-linux-strip RANLIB=arm-linux-ranlib
  • sqlite3的穿插编译
    •   # CC=arm-linux-gcc ./configure --prefix=/your/path/sqlite-3.7.14 --host=arm-linux --disable-tcl

        #make && make install

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/ceping/baogao/276645.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部