Python的移植到arm板上

注意事项:

Python2.4.9

arm-linux-gcc:4.5.1

ubuntu14.0.4                      

一:总体思路

           1、先编译出window下的pgen和Python。

    2、再编译出根据利用window下的pgen(解释器)和Python

二:各个击破

    1、建议window的资源:

      在Python2.4.9下建立一个tool_pc(当然这个随便你)和建立一个tool_arm(等会第二步用)。

      mkdir tool_pc tool_arm

      cd tool_pc

      ../configure

      make(这是在其目录下就有Parser/pgen和Python.exe他们等会就会被用到注意他们的位置别等会写错啦!)

    2、配置:

        cd ../tool_arm

        ./configure--host=arm-linux--build=x86-linux-gnu

--prefix=/usr/pythonLib_arm--disable-ipv6 ac_cv_file__dev_ptmx=no

ac_cv_file__dev_ptmx=no ac_cv_have_long_long_format=yes

注意:

                                                                  ac_cv_file__dev_ptmx=noac_cv_file__dev_ptmx=no

ac_cv_have_long_long_format=yes

(如果不加这三个的它就会报configure: error: set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling

这样的错误当然有三个类似这样的)

  make HOSTPYTHON=../tool_pc HOSTPGEN=../tool_pc/Parser/ BLDSHARED="arm-none-linux-gnueabi-gcc -shared" CROSS_COMPILE=arm-none-linux-gnueabi- CROSS_COMPILE_TARGET=yes HOSTARCH=arm-none-linux-gnueabi BUILDARCH=x86-linux-gnu

注意:

  我出现了这样的错误:

1)on/Python-.7.9/tool_arm'Parser/pgen../Grammar/Grammar Include/graminit.h Python/graminit.c
Parser/pgen: 1: Parser/pgen: Syntax error: word unexpected (expecting ")")
make: *** [Include/graminit.h] Error 2

解决:这个错误搞过移植的都知道它是格式不正确的意思:

如:在#ifdef加了个tab

但在这儿:

你把Python2.4.9/Include/graminit.h打开会发现最顶层有一排是空的我加了#include<stdio.h>

                                                2)  libpython2.7.a(pythonrun.o):/mnt/hgfs/ubuntuShareDirection/Python-                    2.7.9/tool_arm/../Python/pythonrun.c:1480: more undefined references to`_PyParser_Grammar' followcollect2: ld returned 1 exit statusmake: *** [python.exe] Error 1

解决:这个问题主要是pythonrun.c中找不到参数在 _parser_grammer参数你看源码就知道它在python2.4.9/python/graminit.c中它是一个外部变量我尝试了很多办法最好还是有错。最后我就选了最笨的方法:

把graminit.c中的内容全部考到pythonrun.c


make install

会出现libstall错误

在tool_arm中的makefile的install依赖的 commoninstall bininstall maninstall 

他们有些依赖libinstall,把libinstall从他们中去掉。

这种方法有点无赖,影响不大,当然也有影响,你们可以借鉴一下。


总结:

说句实话这种东西你只有亲自动手你就知道它有多恶心了,同样的东西可能会出不用的问题,简直让你。。。

good luck!


这是我改过的Python2.4.9:

http://download.csdn.net/detail/xzy_ok/9855452

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值