如何在我的Linux主机上安装树莓派交叉编译器?

126

我正在尝试在我的Ubuntu机器上实现Raspberry Pi的交叉编译。

在尝试过程中,我使用了arm-linux-gnueabi编译器,该编译器可以在Ubuntu repo中找到。我已经成功使用它进行了构建所有依赖项,并在我的cmake项目中使用了交叉编译器。

然而,我认为我应该使用hf版本,因此我切换到了arm-linux-gnueabihf。然后我意识到这不适用于Raspberry Pi,因为它是armv6架构。

通过一些谷歌搜索,我发现了GitHub上的预构建工具链

我下载了工具链,但我不太清楚如何“安装”它。我将文件提取到了我的home目录中。目录结构看起来像这样:

/gcc-linearo-arm-linux-gnueabihf-raspbian
    /arm-linux-gnueabihf
        /bin
            (contains g++, gcc, etc)
        /lib
            (contains libstdc++ library)
    /bin
        (contains arm-linux-gnueabihf-g++, arm-linux-gnueabihf-...)
    /lib
        (gcc lib stuff)

如果我切换到内部的bin文件夹,我就能够在终端上编译一个测试程序而没有任何问题。

~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/
arm-linux-gnueabihf/bin$ g++ test.cpp -o test

接着我尝试在OUTER bin文件夹中编译一个测试程序,该文件夹包含工具的前缀版本。

 ~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin$ 
 arm-linux-gnueabihf-g++ test.cpp -o test

但是,当我现在尝试使用编译器(从内部bin目录之外)时,它无法找到随工具链提供的libstdc++共享库:

arm-linux-gnueabihf-gcc: error while loading shared libraries: 
libstdc++.so.6: cannot open shared object file: No such file or directory.

此外,我希望能够在不必导航到bin目录的情况下使用编译器。因此,我尝试将OUTER bin目录(因为我想要前缀版本)和两个lib目录添加到我的PATH中:

export PATH=$PATH:~/tools/.../bin
export PATH=$PATH:~/tools/.../lib
export PATH=$PATH:~/tools/.../.../lib

然而,这会导致相同的错误。我应该如何“安装”这个工具链,以便我可以像在使用来自Ubuntu存储库的交叉编译器时一样,在任何地方使用这个工具链?


尝试通过CMAKE_C{XX}_FLAGS设置--sysroot到安装目录。 - auselen
我尝试了一些不同的--sysroot路径,但没有帮助。我不确定应该为sysroot指定哪个路径。有关工具链目录结构,请参见上文。此外,一些谷歌搜索似乎表明--sysroot对于libstdc++没有帮助。 - pqvst
我会尝试使用 /gcc-linearo-arm-linux-gnueabihf-raspbian 或 /gcc-linearo-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf。 - auselen
请前往 https://launchpad.net/gcc-arm-embedded 下载tar压缩包并解压。将路径设置为bin目录...完成。或者前往 codesourcery.com(现在是Mentor Graphics)获取lite版本,进行解压缩,将路径设置为bin目录...完成。 - old_timer
关于RPI SE的相关内容:https://raspberrypi.stackexchange.com/questions/64273/installing-raspberry-pi-cross-compiler/ - Ciro Santilli OurBigBook.com
9个回答

255

我将尝试为您编写教程,以使其易于理解。

注意: 此教程仅适用于旧版Raspbian镜像。对于基于Debian Buster的较新版Raspbian,请参阅此线程中的以下操作说明:https://dev59.com/UmIk5IYBdhLWcg3wke3M#58559140

前提条件

在开始之前,您需要确保已安装以下内容:

apt-get install git rsync cmake libc6-i386 lib32z1 lib32stdc++6

让我们交叉编译一个树莓派镜像!

首先在您的主目录中创建名为raspberrypi的文件夹。

进入此文件夹并下载上述提到的完整工具文件夹:

git clone git://github.com/raspberrypi/tools.git

你想使用三个中的以下一个:gcc-linaro-arm-linux-gnueabihf-raspbian,如果我没有读错的话。
进入你的主目录并添加:
export PATH=$PATH:$HOME/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin

到名为~/.bashrc的文件末尾。

现在你可以注销并重新登录(即重新启动终端会话),或者在终端中运行. ~/.bashrc来在当前终端会话中使用PATH添加。

现在,验证您是否可以访问编译器arm-linux-gnueabihf-gcc -v。您应该会得到类似于以下内容:

Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/home/tudhalyas/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../libexec/gcc/arm-linux-gnueabihf/4.7.2/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: /cbuild/slaves/oort61/crosstool-ng/builds/arm-linux-gnueabihf-raspbian-linux/.b
 uild/src/gcc-linaro-4.7-2012.08/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-
 linux-gnu --target=arm-linux-gnueabihf --prefix=/cbuild/slaves/oort61/crosstool-ng/builds/arm-l
 inux-gnueabihf-raspbian-linux/install --with-sysroot=/cbuild/slaves/oort61/crosstool-ng/builds/
 arm-linux-gnueabihf-raspbian-linux/install/arm-linux-gnueabihf/libc --enable-languages=c,c++,fo
 rtran --disable-multilib --with-arch=armv6 --with-tune=arm1176jz-s --with-fpu=vfp --with-float=
 hard --with-pkgversion='crosstool-NG linaro-1.13.1+bzr2458 - Linaro GCC 2012.08' --with-bugurl=
 https://bugs.launchpad.net/gcc-linaro --enable-__cxa_atexit --enable-libmudflap --enable-libgom
 p --enable-libssp --with-gmp=/cbuild/slaves/oort61/crosstool-ng/builds/arm-linux-gnueabihf-rasp
 bian-linux/.build/arm-linux-gnueabihf/build/static --with-mpfr=/cbuild/slaves/oort61/crosstool-
 ng/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-mpc
 =/cbuild/slaves/oort61/crosstool-ng/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-
 gnueabihf/build/static --with-ppl=/cbuild/slaves/oort61/crosstool-ng/builds/arm-linux-gnueabihf
 -raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-cloog=/cbuild/slaves/oort61/cros
 stool-ng/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --wi
 th-libelf=/cbuild/slaves/oort61/crosstool-ng/builds/arm-linux-gnueabihf-raspbian-linux/.build/a
 rm-linux-gnueabihf/build/static --with-host-libstdcxx='-L/cbuild/slaves/oort61/crosstool-ng/bui
 lds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static/lib -lpwl' --ena
 ble-threads=posix --disable-libstdcxx-pch --enable-linker-build-id --enable-plugin --enable-gol
 d --with-local-prefix=/cbuild/slaves/oort61/crosstool-ng/builds/arm-linux-gnueabihf-raspbian-li
 nux/install/arm-linux-gnueabihf/libc --enable-c99 --enable-long-long
Thread model: posix
gcc version 4.7.2 20120731 (prerelease) (crosstool-NG linaro-1.13.1+bzr2458 - Linaro GCC 2012.08
 )

嘿!我这么做了,但库仍然无法工作!

我们还没有完成!到目前为止,我们只是做了基础部分。

在您的 raspberrypi 文件夹中,创建一个名为 rootfs 的文件夹。

现在,您需要将整个 /lib/usr 目录复制到这个新创建的文件夹中。我通常会启动 rpi 镜像,并通过 rsync 进行复制:

rsync -rl --delete-after --safe-links pi@192.168.1.PI:/{lib,usr} $HOME/raspberrypi/rootfs

其中 192.168.1.PI 应替换为您的树莓派 IP 地址。

现在,我们需要编写一个 cmake 配置文件。在您喜欢的编辑器中打开 ~/home/raspberrypi/pi.cmake,并插入以下内容:

SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER $ENV{HOME}/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc)
SET(CMAKE_CXX_COMPILER $ENV{HOME}/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++)
SET(CMAKE_FIND_ROOT_PATH $ENV{HOME}/raspberrypi/rootfs)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

现在,您应该能够通过添加此额外标志进行编译cmake程序:-D CMAKE_TOOLCHAIN_FILE=$HOME/raspberrypi/pi.cmake
使用cmake hello world示例:
git clone https://github.com/jameskbride/cmake-hello-world.git 
cd cmake-hello-world
mkdir build
cd build
cmake -D CMAKE_TOOLCHAIN_FILE=$HOME/raspberrypi/pi.cmake ../
make
scp CMakeHelloWorld pi@192.168.1.PI:/home/pi/
ssh pi@192.168.1.PI ./CMakeHelloWorld

4
我逐步按照你的教程操作,现在能够顺利编译而没有出现任何错误。谢谢你!感谢你提供cmake示例。 - pqvst
1
这对于简单的项目很有效,但我不能交叉编译依赖opencv的CMAKE项目。我收到以下错误信息:“/opt/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/../../../../arm-linux-gnueabihf/bin/ld: 警告:需要/opt/rpi-rootfs/usr/lib/libopencv_highgui.so的libjpeg.so.8没有找到(尝试使用-rpath或-rpath-link)”。Cmake似乎也将“-Wl,-rpath,/ opt/rpi-rootfs/usr/lib”标志传递给连接器。 - user389238
19
在Ubuntu 13.10上不提供ia32-libs软件包。我使用了代替品libc6-i386 lib32z1 lib32stdc++6 - Ben T
2
很棒的教程答案!有赏金 :) - andrewdotnich
2
谢谢您提供如此详细的教程!请问为什么需要从树莓派机器复制 /lib 和 /usr 文件夹呢? - M.G.
显示剩余10条评论

34

构建适用于新版Raspbian Debian Buster镜像和ARMv6的工具链

@Stenyg的答案仅适用于旧版Raspbian镜像。基于Debian Buster的最近发布的Raspbian需要更新的工具链:

在Debian Buster中,gcc编译器和glibc已经更新到8.3版本。位于git://github.com/raspberrypi/tools.git的工具链仍然基于较旧的gcc 6版本。这意味着使用git://github.com/raspberrypi/tools.git将导致许多编译错误。

本教程基于@Stenyg的答案。除了互联网上的许多其他解决方案之外,本教程还支持基于ARMv6 CPU的旧版Rasperry Pi(A、B、B+、Zero)。 另请参阅:GCC 8交叉编译器输出ARMv7可执行文件而不是ARMv6

设置工具链

没有官方的git存储库包含更新的工具链(请参见https://github.com/raspberrypi/tools/issues/102)。

我创建了一个新的github存储库,其中包括基于GCC8和更新版本的ARMv6的构建和预编译工具链:

https://github.com/Pro/raspi-toolchain

如项目的自述文件中所述,这些是获取工具链的步骤。您也可以自行构建(请参阅README获取更多详细信息)。

  1. 下载工具链:
wget https://github.com/Pro/raspi-toolchain/releases/latest/download/raspi-toolchain.tar.gz
  1. 解压它。注意:由于工具链不是位置无关的,因此必须将其放在/opt/cross-pi-gcc中。
sudo tar xfz raspi-toolchain.tar.gz --strip-components=1 -C /opt
  1. 完成!现在工具链位于 /opt/cross-pi-gcc

  2. 可选步骤,将工具链添加到您的路径中,方法是添加:

export PATH=$PATH:/opt/cross-pi-gcc/bin

将内容添加到名为~/.bashrc的文件末尾。

现在,您可以注销并重新登录(即重新启动终端会话),或在终端中运行 . ~/.bashrc 以在当前终端会话中获取 PATH 添加。

从树莓派获取库

要为自己的树莓派进行交叉编译,可能需要安装一些自定义库,您需要将这些库放入主机上。

创建一个名为$HOME/raspberrypi的文件夹。 在raspberrypi文件夹中,创建一个名为rootfs的文件夹。

现在,您需要将整个/lib/usr目录复制到这个新创建的文件夹中。 我通常通过rsync将rpi镜像带起来并复制它:

rsync -vR --progress -rl --delete-after --safe-links pi@192.168.1.PI:/{lib,usr,opt/vc/lib} $HOME/raspberrypi/rootfs

192.168.1.PI替换为你的Raspberry Pi的IP地址。

使用CMake编译项目

为了让CMake使用你自己的工具链,你需要一个工具链文件来初始化编译器设置。

从这里获取该工具链文件: https://github.com/Pro/raspi-toolchain/blob/master/Toolchain-rpi.cmake

现在你可以通过添加这个额外标志:-D CMAKE_TOOLCHAIN_FILE=$HOME/raspberrypi/pi.cmake和设置正确的环境变量来简单地编译你的cmake程序。

export RASPBIAN_ROOTFS=$HOME/raspberry/rootfs
export PATH=/opt/cross-pi-gcc/bin:$PATH
export RASPBERRY_VERSION=1
cmake -DCMAKE_TOOLCHAIN_FILE=$HOME/raspberry/Toolchain-rpi.cmake ..

这里展示了一个“Hello World”的示例: https://github.com/Pro/raspi-toolchain/blob/master/build_hello_world.sh

在使用rsync时,我收到了“忽略不安全符号链接”的消息。这样可以吗? - Alexandr Zarubkin
嗨,@StefanProfanter,如何使工具链路径独立,以便将其放置在除“/opt/cross-pi-gcc”之外的路径中? - nass
我有一台Mac M1机器,这样我就能够为Raspberry Pi Zero编译我的Rust项目。而且它可以正常工作! - Alexander Korolev
初学者问题:我们需要rsync整个lib和usr目录的原因是什么?我正在按照不同的QT交叉编译器教程进行操作,它也在某个时候说要rsync usr/lib,但是这个文件夹似乎有数千个文件,永远无法完成。是否有一种方法可以选择性地从这里选择要rsync的文件夹,或者只选择最常见的文件夹?例如,这里有一个名为chromium-browser的子文件夹,我不知道它与我将在pi zero上制作的程序有何关系。是否有一种方法只选择我想要使用的库... - user13267
还是说怎样加快 rsync 的速度? - user13267
显示剩余3条评论

6

在我将x64版本的编译器应用到sysroot之前,我无法成功。直到我在pi.cmake中添加了SET(CMAKE_SYSROOT $ENV{HOME}/raspberrypi/rootfs)


我可以在没有设置CMAKE_SYSROOT的情况下运行Hello World示例,但是当尝试使用共享库的项目中的pi.cmake文件时,我遇到了链接器错误libstdc++.so.6未找到。在我设置了CMAKE_SYSROOT之后,一切都运行得很顺畅。 - Michael Hilbert

6
您可以使用Clang。它曾经比GCC更快,现在也很稳定。从源代码构建Clang要容易得多(您在构建过程中可以真正喝杯咖啡)。简而言之:
  1. Get clang binaries (sudo apt-get install clang).. or download and build (read instructions here)
  2. Mount your raspberry rootfs (it may be the real rootfs mounted via sshfs, or an image).
  3. Compile your code:

    path/to/clang --target=arm-linux-gnueabihf --sysroot=/some/path/arm-linux-gnueabihf/sysroot my-happy-program.c -fuse-ld=lld
    

您可以选择使用传统的arm-linux-gnueabihf binutils。然后,您可以在末尾删除“-fuse-ld=lld”标志。

以下是我的cmake工具链文件。

toolchain.cmake

set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)

# Custom toolchain-specific definitions for your project
set(PLATFORM_ARM "1")
set(PLATFORM_COMPILE_DEFS "COMPILE_GLES")

# There we go!
# Below, we specify toolchain itself!

set(TARGET_TRIPLE arm-linux-gnueabihf)

# Specify your target rootfs mount point on your compiler host machine
set(TARGET_ROOTFS /Volumes/rootfs-${TARGET_TRIPLE})

# Specify clang paths
set(LLVM_DIR /Users/stepan/projects/shared/toolchains/llvm-7.0.darwin-release-x86_64/install)
set(CLANG ${LLVM_DIR}/bin/clang)
set(CLANGXX ${LLVM_DIR}/bin/clang++)

# Specify compiler (which is clang)
set(CMAKE_C_COMPILER   ${CLANG})
set(CMAKE_CXX_COMPILER ${CLANGXX})

# Specify binutils

set (CMAKE_AR      "${LLVM_DIR}/bin/llvm-ar" CACHE FILEPATH "Archiver")
set (CMAKE_LINKER  "${LLVM_DIR}/bin/llvm-ld" CACHE FILEPATH "Linker")
set (CMAKE_NM      "${LLVM_DIR}/bin/llvm-nm" CACHE FILEPATH "NM")
set (CMAKE_OBJDUMP "${LLVM_DIR}/bin/llvm-objdump" CACHE FILEPATH "Objdump")
set (CMAKE_RANLIB  "${LLVM_DIR}/bin/llvm-ranlib" CACHE FILEPATH "ranlib")

# You may use legacy binutils though.
#set(BINUTILS /usr/local/Cellar/arm-linux-gnueabihf-binutils/2.31.1)
#set (CMAKE_AR      "${BINUTILS}/bin/${TARGET_TRIPLE}-ar" CACHE FILEPATH "Archiver")
#set (CMAKE_LINKER  "${BINUTILS}/bin/${TARGET_TRIPLE}-ld" CACHE FILEPATH "Linker")
#set (CMAKE_NM      "${BINUTILS}/bin/${TARGET_TRIPLE}-nm" CACHE FILEPATH "NM")
#set (CMAKE_OBJDUMP "${BINUTILS}/bin/${TARGET_TRIPLE}-objdump" CACHE FILEPATH "Objdump")
#set (CMAKE_RANLIB  "${BINUTILS}/bin/${TARGET_TRIPLE}-ranlib" CACHE FILEPATH "ranlib")

# Specify sysroot (almost same as rootfs)
set(CMAKE_SYSROOT ${TARGET_ROOTFS})
set(CMAKE_FIND_ROOT_PATH ${TARGET_ROOTFS})

# Specify lookup methods for cmake
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

# Sometimes you also need this:
# set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

# Specify raspberry triple
set(CROSS_FLAGS "--target=${TARGET_TRIPLE}")

# Specify other raspberry related flags
set(RASP_FLAGS "-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS")

# Gather and distribute flags specified at prev steps.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CROSS_FLAGS} ${RASP_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CROSS_FLAGS} ${RASP_FLAGS}")

# Use clang linker. Why?
# Well, you may install custom arm-linux-gnueabihf binutils,
# but then, you also need to recompile clang, with customized triple;
# otherwise clang will try to use host 'ld' for linking,
# so... use clang linker.
set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld)

4
对于Windows主机,我强烈推荐这个教程:链接
  • 下载并安装工具链
  • 将sysroot与您的RPi include/lib目录同步
  • 编译您的代码
  • 使用SmarTTY将可执行文件拖放到您的RPi中
  • 运行它!

没有更多,也没有更少!

预构建的GNU Toolchains适用于Raspberry、Beaglebone、Cubieboard、AVR(Atmel)等设备。


自从问题正文的第一行是“我正在尝试在我的Ubuntu机器上实现Raspberry Pi的交叉编译。”并且我已经在标题中澄清了这一点以来,我一直在编辑。这个答案仍然受欢迎,但您可能还想在更具体的https://raspberrypi.stackexchange.com/questions/27163/cross-compiling-with-windows-using-eclipse上回答此问题。 - Ciro Santilli OurBigBook.com

3

最初的问题已经发布了相当长的时间,与此同时,Debian在多架构支持方面取得了巨大进展。

多架构是跨编译的伟大成就!

简而言之,要利用Raspbian Jessie的多架构进行交叉编译,需要执行以下步骤:

  • 在Ubuntu主机上,在chroot或LXC容器中安装Debian Jessie amd64。
  • 启用armhf外来架构。
  • 从emdebian工具存储库安装交叉编译器。
  • 通过编写自定义gcc规范文件来调整交叉编译器(默认情况下它会生成ARMv7-A代码)。
  • 从Raspbian存储库安装armhf库(libstdc++等)。
  • 构建您的源代码。

由于这是很多工作,我已经自动化了上述设置。您可以在此处阅读有关此的信息:

为Raspbian进行交叉编译


3

我无法使用来自git://github.com/raspberrypi/tools.git的任何(相当过时的)工具链编译QT5。配置脚本一直失败,出现“无法确定架构”错误,并且包含目录的路径问题非常严重。对我有效的是使用Linaro工具链。

http://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/arm-linux-gnueabihf/runtime-linaro-gcc4.9-2016.02-arm-linux-gnueabihf.tar.xz

与...结合使用

https://raw.githubusercontent.com/riscv/riscv-poky/master/scripts/sysroot-relativelinks.py

未能修复sysroot的符号链接会导致未定义的符号错误,如在此处描述的构建树莓派Qt库时出错。当我尝试使用tools.git中的fixQualifiedLibraryPaths脚本进行修复时,发生了这种情况。其他所有内容都在http://wiki.qt.io/RaspberryPi2EGLFS中详细描述。我的配置设置为: ./configure -opengl es2 -device linux-rpi3-g++ -device-option CROSS_COMPILE=/usr/local/rasp/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /usr/local/rasp/sysroot -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi

/usr/local/rasp/sysroot是我本地Raspberry Pi 3 Raspbian(Jessie)系统副本的路径,/usr/local/qt5pi是交叉编译QT的路径,也必须复制到设备上。请注意,在选择工具链时,Jessie附带GCC 4.9.2。


2
有一个CDP Studio IDE可用,可以使来自Windows和Linux的交叉编译和部署变得非常简单,并且您只需在安装过程中选中树莓派工具链复选框即可。 (PS。它支持GPIO和I2C,因此不需要编写代码来访问它们)
这里有树莓派使用的IDE演示: https://youtu.be/4SVZ68sQz5U 您可以在此处下载IDE:https://cdpstudio.com/home-edition

1
我创建了一个示例存储库,展示了如何使用CMake交叉编译Raspberry Pi 4。它还包括安装工具链以及克隆根文件系统时必需的一些特殊步骤。原则上,也可以将其用于旧版Pi,但工具链可能会有所不同:https://github.com/spacefisch/raspberrypi-crosscompiling

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接