4
MacOS上编译fortran程序
source link: https://itlanyan.com/compile-fortran-programs-on-macos/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
MacOS上编译fortran程序
在 Macbook 上编译 Fortran 程序,出现如下错误:
ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/lib/libSystem.tbd' for architecture x86_64 collect2: error: ld returned 1 exit status
这是由于安装了 Anaconda,默认的 ld
变成 conda 中的 ld
,于是就出现了上面的报错。使用 which
命令查看 ld
程序:
which -a ld # 可能的输出如下 /Users/tlanyan/opt/anaconda3/bin/ld /usr/bin/ld
解决办法有两种:
1. 设置 PATH 环境变量提升 /usr/bin
的优先级:export PATH=/usr/bin:$PATH
;
2. 暂时禁用 conda 环境:conda deactivate
两种方法都可以在编译时使用系统自带的ld,问题就解决了。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK