Python的移植到arm板上
2017-05-29 16:27
274 查看
注意事项:
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
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
相关文章推荐
- vivi在2410 ARM板上移植过程(初级浅析)
- Python2.5.4移植到arm-linux
- Qt程序移植到ARM板上去掉鼠标样子
- 将mysql库移植到arm板上
- 移植Python2.7到ARM-LINUX嵌入式平台
- qt4的安装-应用程序设计及在arm板上的移植
- ARM40移植Python3.6.4
- goAhead 2.5 嵌入式web服务器 移植到 ARM 板上
- 将SQLite移植到ARM板上
- python移植到arm的单板
- wxX11移植到arm板上(序)
- luvcview在arm板上的移植
- GTK+2.0 与 DFB在ARM板上的额移植教程详解
- 成功将qt程序移植到arm板上
- python移植到arm平台
- QTE及QPE在ARM板上的移植
- Mplayer在ARM板上的的移植
- 移植python到arm上--网络上+自己实际出现的问题
- 将SQLite移植到ARM板上 (转)
- 移植Python2.7到ARM-LINUX嵌入式平台