ld: 符号 dyld_stub_binder 未找到(通常在 libSystem.dylib 中)

ld: symbol dyld_stub_binder not found (normally in libSystem.dylib)

Fort运行 编译器不工作,我认为这是一种 PATH 问题。

我使用的是 MacOS Mojave 10.14.5。我试图 运行 从别人那里得到的堡垒 运行 代码。它编译得很好,但是当 运行 编译它时我得到了错误。首先是分段错误,所以我不确定出了什么问题。但我 90% 确定代码没有错,因为它已被其他人运行。但是编译和 运行 宁简单的代码像 HelloWorld 运行 没问题。

我发现我的gfort运行使用的是anaconda版本(4.8.5?),所以我将其更改为Homebrew版本(9.1.0)编辑bashrc文件。之后(我不确定到底是什么改变了问题。我尝试了很多我可以在 Google 上找到的东西,比如重新安装 gcc。我可能弄乱了路径) 我的 fort运行 编译器甚至无法编译 HelloWorld 代码。

PRINT *, "Hello World!"
END                

.

(base) dyn-137-229-27-249:~ jjung11$ gfortran hello.f90 -o hello
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libm.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libm.tbd
ld: symbol dyld_stub_binder not found (normally in libSystem.dylib).  Needed to perform lazy binding to function __gfortran_set_args for architecture x86_64
collect2: error: ld returned 1 exit status

它说我需要进行惰性绑定,但我不知道它是什么意思,即使我在谷歌上搜索了它,我也不知道如何去做。

此外,我在尝试 运行 我自己的代码时多次遇到的错误如下:

(base) dyn-137-229-27-249:~ jjung11$ /Volumes/easystore/code/mhdread_sc ; exit;
dyld: Library not loaded: /sasbuild/local/xmac01/GNU_CC_CXX_7.1/gcc_7.1.0/lib/libgfortran.4.dylib
  Referenced from: /Volumes/easystore/code/mhdread_sc
  Reason: image not found
Abort trap: 6
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]

我试图改变 dyld 路径但没有成功。其实我不太明白它是什么意思。

我目前自己的代码得到的错误如下:

/Volumes/easystore/code/mhdread_sc -grid ../openggcm_run/2008Jun28_002/2008Jun28_002.grid -fin ../openggcm_run/2008Jun28_002/target/2008Jun28_002.3df. -diptime 2008:06:28:10:00:0.000 -fth 2008Jun28_002.TB_GSEorbit.mhd -fsc TB.GSE.orbit -t0 3600 -tt 43200 -dt 60
 test
 3600                                                                                                                                                                                                    
At line 55 of file mhdread_sc.f
Internal Error: get_unit(): Bad internal unit KIND

实际上,尽管我为这个问题苦苦挣扎了好几天,但我只是编程的初学者 (Brew/Xcode/PATH/bashrc/mac),所以请善待解决方案。难的话我可能看不懂

编辑- 新错误

(base) dyn-137-229-27-249:~ jjung11$ which gfortran -a
/usr/local/bin/gfortran
(base) dyn-137-229-27-249:~ jjung11$ gfortran -o hello.f90 hello
ld: can't link with a main executable file 'hello' for architecture x86_64
collect2: error: ld returned 1 exit status

这看起来运行时库的编译器 and/or 版本存在冲突。

~/.bashrc 中删除 anaconda 设置。

然后,确保Apple提供的"developer tools"是up-to-date,更新homebrew,更新gcc/gfortran从homebrew安装。如果这不起作用,我想不出诊断的方法 and/or 远程修复安装。