【问题标题】:How to compile missing extensions modules when cross compiling Python 3.5.2 for ARM on Linux在 Linux 上交叉编译 Python 3.5.2 for ARM 时如何编译缺少的扩展模块
【发布时间】:2016-10-14 15:53:58
【问题描述】:

在为 ARM 交叉编译 Python 时,许多扩展模块都没有构建。如何在 Linux 上为 ARM 交叉编译 Python 3.5.2 时构建缺少的扩展模块,主要是数学、选择、套接字?但是,在为原生平台编译时,扩展模块是正确构建的。

这些是我的交叉编译步骤:

CONFIG_SITE=config.site CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ AR=arm-linux-gnueabihf-ar RANLIB=arm-linux-gnueabihf-ranlib READELF=arm-linux-gnueabihf-readelf ./configure --enable-shared --host=arm-linux --build=x86_64-linux-gnu --disable-ipv6 --prefix=/opt/python3
make
sudo PATH=/home/benny/workspace/projects/webshield/src/dntl_ws/sw/toolchain/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/bin:$PATH make install

这些是交叉编译时构建的模块:

_ctypes_test 
cmath 
_json 
_testcapi 
_testbuffer 
_testimportmultiple 
_testmultiphase 
_lsprof 
_opcode 
parser 
mmap 
audioop 
_crypt 
_csv 
termios 
resource 
nis 
_multibytecodec 
_codecs_kr 
_codecs_jp 
_codecs_cn 
_codecs_tw 
_codecs_hk 
_codecs_iso2022 
_decimal 
_multiprocessing 
ossaudiodev 
xxlimited 
_ctypes 

这些是 x86 机器上的编译步骤:

CONFIG_SITE=config.site ./configure --enable-shared --disable-ipv6 --prefix=/opt/python3
make
sudo make install

这些是本地编译时构建的模块:

_struct 
_ctypes_test 
array 
cmath 
math 
_datetime 
_random 
_bisect 
_heapq 
_pickle 
_json 
_testcapi 
_testbuffer 
_testimportmultiple 
_testmultiphase 
_lsprof 
unicodedata 
_opcode 
fcntl 
grp 
spwd 
select 
parser 
mmap 
syslog 
audioop 
readline 
_crypt 
_csv 
_posixsubprocess 
_socket 
_sha256 
_sha512 
_md5 
_sha1 
termios 
resource 
nis 
binascii 
pyexpat 
_elementtree 
_multibytecodec 
_codecs_kr 
_codecs_jp 
_codecs_cn 
_codecs_tw 
_codecs_hk 
_codecs_iso2022 
_decimal 
_multiprocessing 
ossaudiodev 
xxlimited 
_ctypes 

我还尝试在 ARM 机器上为 ARM 原生构建,并且扩展构建成功。

用于交叉编译的工具链是:

gcc version 4.9.4 20151028 (prerelease) (Linaro GCC 4.9-2016.02) 

我的主机是:

Ubuntu 16.04.1 LTS 
Linux whachamacallit 4.4.0-42-generic #62-Ubuntu SMP Fri Oct 7 23:11:45 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

【问题讨论】:

  • 为便于阅读/语法编辑

标签: python python-3.x arm cross-compiling embedded-linux


【解决方案1】:

根本原因(礼貌:Xavier de Gaye)

已经有一个原生的python3.5(来自Ubuntu存储库)是PATH。所以问题是 build_extensions() 中的 setup.py 没有构建已经静态构建到这个本机 Ubuntu 解释器中的扩展。 http://bugs.python.org/issue28444#msg278717

临时解决方案

已在http://bugs.python.org/issue28444 提交了一个补丁,并且正在成功运行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-08-26
    • 2012-01-26
    • 2012-12-19
    • 2011-05-20
    • 2013-05-31
    • 1970-01-01
    • 2016-10-20
    • 1970-01-01
    相关资源
    最近更新 更多