iis服务器助手广告广告
返回顶部
首页 > 资讯 > 后端开发 > Python >Python cross compile
  • 919
分享到

Python cross compile

Pythoncrosscompile 2023-01-31 01:01:38 919人浏览 薄情痞子

Python 官方文档:入门教程 => 点击学习

摘要

之前一直想要把python程序移植到arm9开发板上,因为没有理解Python的运行原理,所以一直瞎折腾,最后才知道需要先在arm9开发板上安装一个python的运行环境,这个需要交叉编译(cross compile)。于是搜各种资料。。。

之前一直想要把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)

--结束END--

本文标题: Python cross compile

本文链接: https://www.lsjlt.com/news/184903.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • Python cross compile
    之前一直想要把python程序移植到arm9开发板上,因为没有理解python的运行原理,所以一直瞎折腾,最后才知道需要先在arm9开发板上安装一个python的运行环境,这个需要交叉编译(cross compile)。于是搜各种资料。。。...
    99+
    2023-01-31
    Python cross compile
  • python compile、eval、
    compile函数    compile()函数允许程序员在运行时刻迅速生成代码对象,然后就可以用exec 语句或者内建函数eval()来执行这些对象或者对它们进行求值。一个很重要的观点是:exec 和eval()都可以执行字符串格式的Py...
    99+
    2023-01-31
    python compile eval
  • python内置函数3-compile(
    Help on built-in function compile in module __builtin__:compile(...)    compile(source, filename, mode[, flags[, dont_in...
    99+
    2023-01-31
    函数 python compile
  • Python 正则表达式:compile
    本文以匹配×××ID为例,介绍re模块的compile与match的用法复杂匹配 = re.compile(正则表达式): 将正则表达式实例化             +        re.match(要匹配的字符串): 从字符串开 头/...
    99+
    2023-01-31
    正则表达式 Python compile
  • Python的compile函数怎么用
    今天小编给大家分享一下Python的compile函数怎么用的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一下吧。实例>>...
    99+
    2023-06-08
  • python中compile的作用有哪些
    在Python中,compile函数的作用有以下几种:1. 将字符串形式的源代码编译为可执行代码。编译后的代码可以使用exec函数执...
    99+
    2023-09-26
    python compile
  • python编译表达式方法compile
      re包含一些模块级函数,用于处理作为文本字符串的正则表达式,不过对于程序频繁使用的表达式,编译这些表达式会更为高效。compile()函数会把一个表达式字符串转换为一个RegexObject。   import re   regexes...
    99+
    2023-01-31
    表达式 方法 python
  • Python的compile函数语法是什么
    这篇文章主要介绍“Python的compile函数语法是什么”,在日常操作中,相信很多人在Python的compile函数语法是什么问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Python的compile函...
    99+
    2023-06-08
  • Compile invalids的示例代码
    小编给大家分享一下Compile invalids的示例代码,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!cat compile_invalids. . ~/.prof...
    99+
    2024-04-02
  • Python函数介绍:compile函数的功能和示例
    Python函数介绍:compile函数的功能和示例一、compile函数的功能在Python中,compile函数是一个内置函数,用于编译源代码为可执行代码或AST对象。它返回一个代码对象,可以被exec或eval语句执行。compile...
    99+
    2023-11-03
    功能 示例 compile函数
  • Vue编译器分析compile源码
    这篇文章主要介绍“Vue编译器分析compile源码”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“Vue编译器分析compile源码”文章能帮助大家解决问题。引言在 compileToFunctio...
    99+
    2023-07-02
  • sql中cross join的用法是什么
    在SQL中,CROSS JOIN是一种用于返回两个表之间的笛卡尔积的操作。也就是说,它会返回两个表的所有可能的组合。 例如,假设有两...
    99+
    2024-04-09
    sql
  • Python函数介绍:compile函数的功能和使用示例
    Python函数介绍:compile函数的功能和使用示例在Python编程中,compile()函数是一个内置函数,它的作用是将字符串形式的Python代码编译为字节码或AST对象。编译之后,可以通过执行该字节码或AST对象来实现代码的运行...
    99+
    2023-11-04
    功能 Python函数 使用示例 compile函数
  • pattern类compile方法怎么使用
    Pattern类的compile方法用于编译正则表达式模式,并返回一个Pattern对象。Pattern对象可以用于匹配字符串。使用...
    99+
    2023-08-11
    pattern compile
  • SourceCodester Yoga Class Registration System list.php cross site scripting
    SourceCodester Yoga Class Registration System list.php cross site scripting url:admin/user/list.php ...
    99+
    2023-10-04
    php 开发语言
  • 解决 strict-origin-when-cross-origin 问题
    项目场景: 使用90版本之后的谷歌浏览器, 在部署前端项目后, 调用后端接口出现 strict-origin-when-cross-origin, 并且静态资源被拦截的情况 问题描述: 使用90...
    99+
    2023-09-09
    前端 java 开发语言
  • Python中字符串类型代码的执行函数——eval()、exec()和compile()详解
    目录字符串类型代码的执行eval()exec()compile()字符串类型代码的执行 字符串类型代码的执行函数有三个,都是Python的内置函数。 eval()执行字符串类型的代码...
    99+
    2023-02-07
    Python中字符串类型代码的执行函数 Python eval() exec()和compile()
  • css背景函数cross-fade()有什么用
    小编给大家分享一下css背景函数cross-fade()有什么用,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!cross-fade()cross-fade用于在两...
    99+
    2023-06-08
  • Spark SQL中出现CROSS JOIN 问题该怎么解决
    这篇文章将为大家详细讲解有关Spark SQL中出现CROSS JOIN 问题该怎么解决,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。问题显示如下所示:    ...
    99+
    2023-06-04
  • 基于strict-origin-when-cross-origin问题的解决
    目录项目场景问题描述原因分析解决方案总结项目场景 使用90版本之后的谷歌浏览器,在部署前端项目后, 调用后端接口出现 strict-origin-when-cross-origin,...
    99+
    2023-03-11
    strict-origin-when-cross-origin strict-origin-when-cross-origin问题
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作