[英]How do I fix `ld: unexpected token: !tapi-tbd-v3 file` with gfortran on my Mac?
I keep getting this error whenever I try and compile a .f90 file on my Mac Mojave (10.14)每当我尝试在 Mac Mojave (10.14) 上编译 .f90 文件时,我都会收到此错误
collect2: fatal error: ld terminated with signal 11 [Segmentation fault: 11] compilation terminated.
collect2:致命错误:ld 以信号 11 [Segmentation fault: 11] 终止,编译终止。 ld: unexpected token: !tapi-tbd-v3 file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd' for architecture x86_64
ld: 意外标记: !tapi-tbd-v3 文件 '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd' 用于架构 x86_64
I've tried uninstalling Xcode and command line tools multiple times as well as created a symlink to the *tbd file so it doesn't require the tbd files anymore.我已经多次尝试卸载 Xcode 和命令行工具,并创建了一个指向 *tbd 文件的符号链接,因此它不再需要 tbd 文件。 I've also tried deleting gfortran from my laptop and reinstalling it again but it's still not working.
我也试过从我的笔记本电脑中删除 gfortran 并重新安装它,但它仍然无法正常工作。
I don't really know how to go about fixing this problem and I'm also a beginner at this compiler/linker topic.我真的不知道如何解决这个问题,而且我也是这个编译器/链接器主题的初学者。 Any help would be greatly appreciated.
任何帮助将不胜感激。
In case you installed gfortran via MacPorts, please uninstall it and install the xcode variant of the ld64 port:如果您通过 MacPorts 安装了 gfortran,请卸载它并安装 ld64 端口的 xcode 变体:
sudo port install ld64 +ld64_xcode
After this, install gcc (version N) with -s
to build it on your local machine:在此之后,使用
-s
安装 gcc(版本 N)以在本地机器上构建它:
sudo port install libgcc<N> libgcc
sudo port install -s gcc<N>
Unfortunately, I'm not familiar with solutions not using MacPorts.不幸的是,我不熟悉不使用 MacPorts 的解决方案。
After installing macports, the below 2 commands worked for me安装 macports 后,以下 2 个命令对我有用
sudo port -f activate ld64
sudo port install ld64 +ld64_xcode
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.