无法在 MacOS Monterey 上编译 fortran:ld:YAML 文件中不支持的 tapi 文件类型 '!tapi-tbd'

问题描述 投票:0回答:2

每当我尝试编译 Fortran 代码时,我都会遇到错误:

% gfortran Testing_Fortran.f90 -o Testing_Fortran

ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/lib/libSystem.tbd' for architecture x86_64 collect2: error: ld returned 1 exit status

通过互联网查看类似问题,我找到的最常见的解决方案是降级 XCode 命令行工具,并重新安装 gcc,但这些都不起作用。

我试过 CLTools 14.1 和 13.4,我正在通过自制软件安装 gcc。 gfortran 版本是 12.2.0。我在 MacOS Monterey 12.6.

有什么想法吗?提前致谢。

gcc ld gfortran macos-monterey xcode-command-line-tools
2个回答
3
投票

您的

ld
可能不是最新的系统链接器:在这张帮助单上 和一位同事的问题是
ld
指向一个来自 Anaconda 的链接器。如果你的 $PATH 设置为 Anaconda 的
ld
比系统链接器有更高的优先级,这将解释它:

$ which -a ld
/blah/anaconda3/bin/ld
/usr/bin/ld

如果是这种情况,请重新排序您的 PATH 以将 anaconda 的目录放在

/usr/bin
之后。然后,
which ld
应该指向系统
ld
,你就可以开始了。


0
投票

我有一个类似的问题。我刚刚停用 Anaconda 并运行 fortran 代码。

conda deactivate
gfortran Testing_Fortran.f90 -o Testing_Fortranc

再次回到 Anaconda 环境,

conda activate
© www.soinside.com 2019 - 2024. All rights reserved.