【发布时间】:2018-04-16 16:47:01
【问题描述】:
我不知道这里是否适合提问,所以如果我做错了什么,请告诉我。
我正在学习 c 编程,我正在尝试设置 git,因为我也想学习它。我遵循了一些说明,git 似乎工作正常,但现在每当我输入一些 gcc 命令时都会出错。
我是整个终端的新手,并尝试了一些我在 stackoverflow 上找到的命令,但这并没有解决我的问题。
我在尝试编译 C 程序后收到以下消息:
dyld: Library not loaded: /usr/local/lib/libmpfr.4.dylib Referenced
from: /usr/local/libexec/gcc/x86_64-apple-darwin15.0.0/6.1.0/cc1
Reason: image not found
gcc: internal compiler error: Abort trap: 6 (program cc1)
运行 'brew doctor' 后,我还得到以下输出:
Warning: You have unlinked kegs in your Cellar Leaving kegs unlinked
can lead to build-trouble and cause brews that depend on those kegs to
fail to run properly once built. Run brew link on these: gawk
Warning: Homebrew's sbin was not found in your PATH but you have
installed formulae that put executables in /usr/local/sbin. Consider
setting the PATH for example like so echo 'export
PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile
gcc 也是我与“brew link gcc”链接的未链接小桶的一部分,它最初给出了一些错误消息,但在从 SE 运行命令后它起作用了。
如果我运行“gcc --version”,我会得到通常的输出(gcc 版本 6.1.0)。
任何帮助将不胜感激,因为我渴望继续编程,这有点破坏了我平静的编码之夜:(
谢谢。
编辑:恢复备份后,$brew update $brew upgrade:
==> Pouring gcc-7.3.0_1.high_sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/gfortran
Target /usr/local/bin/gfortran
already exists. You may want to remove it:
rm '/usr/local/bin/gfortran'
To force the link and overwrite all conflicting files:
brew link --overwrite gcc
To list all files that would be deleted:
brew link --overwrite --dry-run gcc
Possible conflicting files are:
/usr/local/bin/gfortran
【问题讨论】:
-
将
sbin放回PATH时会发生什么? -
嘿斯里尼,谢谢,正如我所说我很新,所以我导出 PATH=$PATH:/usr/local/sbin 然后 brew reinstall gcc,但我仍然收到相同的消息.
-
Homebrew 在添加后仍然抱怨
sbin不在PATH上? -
这个问题没有解决,谢谢!但 gcc 仍然无法正常工作
-
我在尝试更新 gcc 时做了 rm '/usr/local/bin/gfortran' 这会导致错误吗?