【发布时间】:2020-04-06 23:42:31
【问题描述】:
我发现在我的 Ubuntu19.04 64 位机器上安装交叉编译器时出现问题。我想将 python 代码交叉编译为运行 Debian Stretch 的树莓派 3 模型 b+ 的可执行文件。 我遵循了许多指南,但没有一个有效。我其实在关注https://github.com/Yadoms/yadoms/wiki/Cross-compile-for-raspberry-PI
我按照上述书面指南的步骤进行操作: - 设置环境 - 安装交叉编译器 - 提升 1.64 - 蟒蛇
在最后一部分(Python)上,它无法执行最后一条指令。
$ CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ AR=arm-linux-gnueabihf-ar RANLIB=arm-linux-gnueabihf-ranlib ./configure --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --build=x86_64-linux-gnu --prefix=$HOME/Desktop/rapsberry/depsBuild/python --disable-ipv6 ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no ac_cv_have_long_long_format=yes --enable-shared
输出:
checking build system type... x86_64-pc-linux-gnu
checking host system type... arm-unknown-linux-gnueabihf
checking for python3.7... python3.7
checking for python interpreter for cross build... python3.7
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... checking for --without-gcc... no
checking for --with-icc... no
checking for arm-linux-gnueabihf-gcc... arm-linux-gnueabihf-gcc
checking whether the C compiler works... no
configure: error: in `/home/slr/Desktop/raspberry/boost_1_64_0/Python-3.7.5':
configure: error: C compiler cannot create executables
See `config.log' for more details
然后:
$ make HOSTPYTHON=$HOME/Desktop/raspberry/depsBuild/pythonhost/python HOSTPGEN=$HOME/Desktop/raspberry/depsBuild/pythonhost/Parser/pgen BLDSHARED="arm-linux-gnueabihf-gcc -shared" CROSS-COMPILE=arm-linux-gnueabihf- CROSS_COMPILE_TARGET=yes HOSTARCH=arm-linux BUILDARCH=arm-linux-gnueabihf
输出:
make: *** No targets specified and no makefile found. Stop.
我需要 python3 来实现我的目的。
我真的陷入了这个问题,有人可以提供一些想法吗?我也尝试使用 QEMU 和 Docker (https://raspberrypi.stackexchange.com/questions/109488/building-a-virtual-machine-with-the-img-file-of-the-raspberry-pi-stretch),但它们都未能编译我的目标代码:
gcc: internal compiler error
我的代码很长(几千行),而小代码可以成功运行。感谢您的建议。
【问题讨论】:
标签: python linux gcc raspberry-pi cross-platform