如何在 Ubuntu 中使用 arm-linux-gnueabihf-g++ 在 amd64 系统上交叉编译 32 位 arm 架构的应用程序

Cod*_*eve 3 c++ linux arm cross-platform cross-compiling

我是 arm-linuxgnueabihf-g++ 的新手。我正在使用 Ubuntu 14.04 并安装了 arm-linuxgnueabihf-g++-4.7 的 amd64 机器上工作。我想针对 32 位 arm 架构交叉编译我的应用程序。

我运行命令:

arm-linux-gnueabihf-g++ -m32 hello.cpp -o hello.
Run Code Online (Sandbox Code Playgroud)

但它给了我错误:arm-linux-gnueabihf-g++:错误:

unrecognized command line option ‘-m32’.
Run Code Online (Sandbox Code Playgroud)

互联网上似乎很少有关于 arm-linux-gnueabihf-g++ 的文档。

任何人都可以给我一些帮助吗?

uni*_*urf 5

-m32是一个 x86 选项。它在 ARM 上不受支持(或不需要),其中 32 位和 64 位代码使用不同的工具链。

64 位 ARM (AArch64) 工具链称为 aarch64-linux-gnu。

  • 谢谢。如果我想在 amd64 机器上编译针对 32 位 ARM 的代码,我应该使用什么工具链? (2认同)