在 Buildroot 中使用外部工具链时生成错误

Build error when using external toolchain in Buildroot

我正在尝试在 Buildroot 中使用外部工具链选项,并将 gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.gz 用作外部工具链。我正在按照 Buildroot manual 第 6.1.3 节中提到的步骤进行操作。我已经有了工具链 tarball,所以我没有做 make sdk 部分。在 menuconfig 中,我指定如下:

  1. 将工具链类型设置为外部工具链
  2. 将工具链设置为自定义工具链
  3. 设置Toolchain origin为要下载安装的Toolchain
  4. 将工具链 URL 设置为 file:///path/to/your/sdk/tarball.tar.gz :在我的例子中,我将其设置为 file:////root/br-tcg4/tmp/gcc-linaro-7.5.0- 2019.12-x86_64_arm-linux-gnueabihf.tar.gz

然后,当我执行 make 时,出现以下错误:

.
.
.
Unpacking toolchain to "/root/br-tcg4/bat/buildscripts/../../tmp/toolchain" ...
done

Current STW RootFs version: "STW-V4.00r1"
Have you updated the version? Do you want to continue? [Y/n] Y
Make rfs ...
make: Entering directory '/root/br-tcg4/libs/br_pjt'
Makefile:1051: warning: overriding recipe for target '/root/br-tcg4/libs/br_pjt/output/staging'
Makefile:475: warning: ignoring old recipe for target '/root/br-tcg4/libs/br_pjt/output/staging'
/usr/bin/make -j1 O=/root/br-tcg4/libs/br_pjt/output HOSTCC="/usr/bin/gcc" HOSTCXX="/usr/bin/g++" syncconfig
make[1]: Entering directory '/root/br-tcg4/libs/br_pjt'
make[1]: Leaving directory '/root/br-tcg4/libs/br_pjt'
tar-1.29.cpio.gz: OK (sha256: 9173f222464dd3676118408840da5990527062b5c7daf6487bed7c396c45bfb1)
>>> toolchain-external-custom  Downloading
cp: cannot stat '/root/br-tcg4/tmp/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.gz': No such file or directory
--2022-02-01 20:02:13--  http://sources.buildroot.net/toolchain-external-custom/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.gz
Resolving sources.buildroot.net (sources.buildroot.net)... 172.67.72.56, 104.26.1.37, 104.26.0.37, ...
Connecting to sources.buildroot.net (sources.buildroot.net)|172.67.72.56|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-02-01 20:02:14 ERROR 404: Not Found.

--2022-02-01 20:02:14--  http://sources.buildroot.net/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.gz
Resolving sources.buildroot.net (sources.buildroot.net)... 172.67.72.56, 104.26.1.37, 104.26.0.37, ...
Connecting to sources.buildroot.net (sources.buildroot.net)|172.67.72.56|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-02-01 20:02:14 ERROR 404: Not Found.

make: *** [package/pkg-generic.mk:171: /root/br-tcg4/libs/br_pjt/output/build/toolchain-external-custom/.stamp_downloaded] Error 1
make: Leaving directory '/root/br-tcg4/libs/br_pjt'

------------- Error occured! -------------

当我检查 http://sources.buildroot.net/toolchain-external-custom 时,没有文件 gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.gz

谁能告诉我如何在 Buildroot 中正确使用外部工具链选项?

非常感谢您的帮助。

提前致谢

P.S:我正在使用 Buildroot 2020.02.12 和 Ubuntu 20.04 作为构建系统。如果此处缺少任何信息,请告诉我。

既然您似乎已经下载了自定义工具链 tarball,为什么不简单地手动安装(即 un-archive)自定义工具链,然后选择适当的 Buildroot 选项(即 Pre-installed toolchain)?

例如,我在 /opt/ 下安装了工具链,在 /opt/linaro/ 下安装了 Linaro 工具链。您正在使用的相同工具链安装在我的开发 PC 上:

$ ls -go /opt/linaro/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf
total 36
drwxr-xr-x 6  4096 Dec  4  2019 arm-linux-gnueabihf
drwxr-xr-x 2  4096 Dec  4  2019 bin
-rw-r--r-- 1 11337 Dec  4  2019 gcc-linaro-7.5.0-2019.12-linux-manifest.txt
drwxr-xr-x 3  4096 Dec  4  2019 include
drwxr-xr-x 3  4096 Dec  4  2019 lib
drwxr-xr-x 3  4096 Dec  4  2019 libexec
drwxr-xr-x 8  4096 Dec  4  2019 share
$

Buildroot 将简单地使用指向 pre-installed 可执行文件的符号链接来提高存储效率。因此,当您有多个使用相同外部工具链的 Buildroot 项目目录时,每个 pre-installed 工具链可执行文件只有一个副本。而如果您(下载并)安装外部工具链,每个 Buildroot 项目目录将有其自己的可执行文件副本。

Can anyone please let me know how to properly use external toolchain option in Buildroot?

以下 Buildroot 菜单配置是为 /opt/linaro/... 上的 pre-installed Linaro 工具链设置的,它对我来说工作可靠:

    Toolchain type (External toolchain)  --->
    *** Toolchain External Options ***
    Toolchain (Custom toolchain)  --->
    Toolchain origin (Pre-installed toolchain)  --->
(/opt/linaro/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/) Toolchain path 
(arm-linux-gnueabihf) Toolchain prefix
    External toolchain gcc version (7.x)  --->
    External toolchain kernel headers series (4.10.x)  --->
    External toolchain C library (glibc/eglibc)  --->
[*] Toolchain has SSP support?
[*]   Toolchain has SSP strong support?
[*] Toolchain has RPC support?
[*] Toolchain has C++ support?
[ ] Toolchain has D support?
[ ] Toolchain has Fortran support?
[ ] Toolchain has OpenMP support?
[ ] Copy gdb server to the Target
    *** Host GDB Options ***
...