为 Raspberry Pi 选择交叉编译器

Selecting cross compiler for Raspberry Pi

正在寻找可以帮助我在 Ubuntu 20.04 机器上为 Raspberry Pi 构建应用程序的交叉编译器。我发现 official tools on Github 并且我认为文件夹 arm-bcm2708 包含交叉编译器:

arm-bcm2708hardfp-linux-gnueabi
arm-bcm2708-linux-gnueabi
arm-linux-gnueabihf -> arm-rpi-4.9.3-linux-gnueabihf
arm-rpi-4.9.3-linux-gnueabihf
gcc-linaro-arm-linux-gnueabihf-raspbian
gcc-linaro-arm-linux-gnueabihf-raspbian-x64

我很困惑目录名称试图告诉我什么?我知道以下单词:

arm - processor type used on Pi
bcm2708 - processor model used on pi
gnueabi - cross-compiler for armel architecture (you can build binary for ARM on PC)
linaro - company that creates multimedia for ARM
4.9.3 - I suppose is GCC compiler version (why it is so old?)

我的 Pi3 和 Pi4 应该使用哪个编译器?

您可以为您的 RPI3/4 使用工具链之一 provided by ARM。 如果您 运行 在 RPI3/4 上使用 32 位 Linux,请使用 arm-none-linux-gnueabihf 工具链之一,如果使用的是 运行 64 位 Linux 在你的 RPI3/4 上,使用 aarch64-none-linux-gnu 之一。

这两个工具链的 10.2 和 9.2 版本在我自己的 Ubuntu 20.04.1 LTS x86_64 系统上运行良好。当然,您也可以使用 arm-none-linux-gnueabihf 工具链和 运行 在 64 位 Linux 运行 上交叉编译程序 RPI3/4。