macOS Mojave10.14.4 + GNU gcc8:ld:意外令牌:!tapi-tbd-v3文件'/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd'

时间:2019-04-19 13:03:52

标签: c macos-mojave gcc8

我已使用gcc 8.3.0在macOS Mojave 10.14.4系统上安装了最新的homebrew

$ gcc -v
Using built-in specs. 
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/8.3.0/libexec/gcc/x86_64-apple-darwin18.2.0/8.3.0/lto-wrapper
Target: x86_64-apple-darwin18.2.0
Configured with: ../configure --build=x86_64-apple-darwin18.2.0 --prefix=/usr/local/Cellar/gcc/8.3.0 --libdir=/usr/local/Cellar/gcc/8.3.0/lib/gcc/8 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-8 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --with-pkgversion='Homebrew GCC 8.3.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
Thread model: posix
gcc version 8.3.0 (Homebrew GCC 8.3.0)

还安装了最新版本的XCode和命令行工具:

$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

因此,我有下面的伪hello.c代码:

#include <stdio.h>
int main(int argc, char *argv[]) {
    printf("Hello world!\n");
    return 0;
}

我使用以下虚拟命令进行编译:

$ gcc -o hello hello.c

我收到以下错误:

collect2: fatal error: ld terminated with signal 
11 [Segmentation fault: 11] compilation terminated.
ld: unexpected token: !tapi-tbd-v3 file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd' for architecture x86_64

这个“虚拟”问题足以表明我无法在系统上使用GNU gcc编译更复杂的东西(使用makefile)。

是GNU gcc与LLVM ld链接器搞混了吗?

有任何提示吗?

0 个答案:

没有答案