设为首页 收藏本站
查看: 1148|回复: 0

[经验分享] Python cross compile 失败

[复制链接]

尚未签到

发表于 2018-8-11 12:39:54 | 显示全部楼层 |阅读模式
  之前一直想要把python程序移植到arm9开发板上,因为没有理解python的运行原理,所以一直瞎折腾,最后才知道需要先在arm9开发板上安装一个python的运行环境,这个需要交叉编译(cross compile)。于是搜各种资料。。。
  1. 编译环境与工具
  系统环境:Red_Hat_Enterprise_Linux_5;
  开发板销售商给我提供了一个交叉编译工具:arm-linux-gcc-4.3.3.tar.gz;
  到Python官网下载了python2.7.2.tar.gz;
  以及一个交叉编译的补丁,下载地址(http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html);
  2. 编译过程:
  1. 参考此网站的编译步骤:http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html;
  2. 参考此网站的编译参数:http://yangyang.in/?p=127;
  但是在configure之后,在执行make命令的时候总是出错,错误如下:
  arm-linux-gcc -c -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include   -DPy_BUILD_CORE -o Modules/python.o ./Modules/python.c
  In file included from Include/Python.h:58,
  from ./Modules/python.c:3:
  Include/pyport.h:147: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Py_intptr_t'
  make: *** [Modules/python.o] Error 1
  3. 尝试解决办法:
  1.更换过的操作系统:Ubuntu,Fedora9, Fedora11, OpenSUSE 64-bit,CentOS 64-bit,Debian6
  2.更换不同版本的Python,2.7.3 以及2.7.2,暂未尝试其他版本。
  以上所有更改均未能顺利编译,不知问题在哪里,当然不太怀疑Python版本问题,毕竟那么多人都成功的交叉编译了
  附:Fedora 11信息
  gcc -v:
  Using built-in specs.
  Target: i586-redhat-linux
  Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch=i586 --build=i586-redhat-linux
  Thread model: posix
  gcc version 4.4.0 20090506 (Red Hat 4.4.0-4) (GCC)
  arm-linux-gcc -v:
  Using built-in specs.
  Target: arm-none-linux-gnueabi
  Configured with: /scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/src/gcc-4.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --with-specs='%{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}' --enable-languages=c,c++ --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2009q1-203' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/obj/host-libs-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/obj/host-libs-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/bin
  Thread model: posix
  gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203)

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-550156-1-1.html 上篇帖子: python 定时器 下篇帖子: Python 日期格式相关
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表