首页 > 解决方案 > MacOS 10.15.6 gcc 上的 Buildroot 2021.08.x 未安装错误

问题描述

尝试在 MacOS 10.15.6 上使用 Buildroot 2021.08.x 构建一个非常简单的测试映像,并收到未安装 gcc 的错误:

z:buildroot User$ make
sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
LLVM ERROR: IO failure on output stream: Broken pipe
/bin/sh: line 0: [: : integer expression expected
sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]

You must install 'gcc' on your build machine
make: *** [dependencies] Error 1

我用brew安装并重新安装了gcc。用 brew 安装的版本是 11.2.0

z:~ User$ brew list --versions gcc
gcc 11.2.0

但 gcc --version 输出如下所示:

z:~ User $ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

有任何想法吗?

标签: macosgccbuildroot

解决方案


您不应该将 clang 用于 buildroot 编译器。

您必须将 gcc 命令链接到 homebrew 安装的位置。


推荐阅读