Macos ld:symbol未找到dyld_存根_活页夹(通常在libSystem.dylib中)

Macos ld:symbol未找到dyld_存根_活页夹(通常在libSystem.dylib中),macos,fortran,homebrew,gfortran,Macos,Fortran,Homebrew,Gfortran,Fortran编译器不工作,我认为这是一种路径问题 我用的是MacOS Mojave 10.14.5。我试着运行从别人那里得到的fortran代码。它编译得很好,但在运行它时出现了错误。首先是分割错误,所以我不确定是什么问题。但我90%肯定代码没有错,因为它是由其他人运行的。但是编译和运行像HelloWorld这样的简单代码运行得很好 我发现我的gfortran使用的是anaconda版本(4.8.5?),所以我将其更改为自制版本(9.1.0)编辑bashrc文件。之后(我不确定到底是什么改变了

Fortran编译器不工作,我认为这是一种路径问题

我用的是MacOS Mojave 10.14.5。我试着运行从别人那里得到的fortran代码。它编译得很好,但在运行它时出现了错误。首先是分割错误,所以我不确定是什么问题。但我90%肯定代码没有错,因为它是由其他人运行的。但是编译和运行像HelloWorld这样的简单代码运行得很好

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

PRINT *, "Hello World!"
END                

它说我需要做惰性绑定,但我不知道这意味着什么,即使我在谷歌上搜索它,我也无法学会如何做

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

(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]
/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
我试图改变dyld路径,但没有成功。事实上,我不知道这意味着什么

我自己的代码当前出现以下错误:

(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]
/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

看起来编译器和/或运行库的版本存在冲突

~/.bashrc
中删除蟒蛇设置


然后,确保苹果提供的“开发者工具”是最新的,更新homebrew,从homebrew更新gcc/gfortran安装。如果这不起作用,我想不出远程诊断和/或修复安装的方法。

要进行诊断,请给出
which-a gfortran
@pierredebyl(base)$which-a gfortran/usr/local/bin/gfortran/Users/jjung11/anaconda3/bin/gfortran/usr/local/bin/gfortran的结果这里有两个安装,如果只打算使用conda版本,我建议您删除
/usr/local/bin/gfortran
。你是如何安装的?(自编译、二进制安装程序等)?你的电脑是管理的还是管理员?@pierredebyl我不是管理员,但我可以使用sudo。anaconda one是在我为Python3安装anaconda时自动安装的。我使用brew install gcc安装/usr/local/bin/gfortran(我想)。一个问题是anaconda One的版本较低(4.8.5),我不知道如何更新它。能否从
~/.bashrc
中删除anaconda设置,重新启动终端,然后重试?您可能需要注销并再次登录(我不知道mac os在什么时候重新初始化外壳环境)。有趣的是,您建议删除anaconda设置。我在编译Golang项目时遇到了类似的问题。原来问题是我改变了我的康达环境。当我回到康达基地时,一切都被修复了。谢谢你的解释,它帮助我解决了我的问题。