是否可以从我的mac中完全删除GCC?如果是这样,我该怎么做?

时间:2016-02-01 00:31:49

标签: macos gcc homebrew

我最近在试图让它与openMP一起工作后完全搞砸了GCC。现在,GCC甚至无法在C中编译/运行一个简单的“helloworld”程序。当我输入“gcc helloworld.c -o Result”时,它会给我一个“ld:找不到-lgcc的库”错误。

每次我尝试通过做类似的事情来安装gcc /重新安装gcc gcc with --without-multilib,它给我这样的东西:

==> Reinstalling gcc with --without-multilib
==> Downloading http://ftpmirror.gnu.org/gcc/gcc-5.3.0/gcc-5.3.0.tar.bz2
==> Downloading from http://open-source-box.org/gcc/gcc-5.3.0/gcc-5.3.0.tar.bz2
######################################################################## 100.0%

^[[D==> Patching
patching file gcc/jit/Make-lang.in
patching file gcc/jit/jit-playback.c
Hunk #1 succeeded at 2470 with fuzz 2 (offset 54 lines).
==> ../configure --build=x86_64-apple-darwin15.2.0 --prefix=/usr/local/Cellar/gc
^R

==> make bootstrap
Last 15 lines from /Users/bettyjing/Library/Logs/Homebrew/gcc/02.make:
checking for a BSD-compatible install... /usr/bin/install -c
checking for gawk... awk
checking for x86_64-apple-darwin15.2.0-ar... ar
checking for x86_64-apple-darwin15.2.0-lipo... lipo
checking for x86_64-apple-darwin15.2.0-nm... /private/tmp/gcc20160131-67124-kpenwb/gcc-5.3.0/build/./gcc/nm
checking for x86_64-apple-darwin15.2.0-ranlib... ranlib
checking for x86_64-apple-darwin15.2.0-strip... strip
checking whether ln -s works... yes
checking for x86_64-apple-darwin15.2.0-gcc... /private/tmp/gcc20160131-67124-kpenwb/gcc-5.3.0/build/./gcc/xgcc -B/private/tmp/gcc20160131-67124-kpenwb/gcc-5.3.0/build/./gcc/ -B/usr/local/Cellar/gcc/5.3.0/x86_64-apple-darwin15.2.0/bin/ -B/usr/local/Cellar/gcc/5.3.0/x86_64-apple-darwin15.2.0/lib/ -isystem /usr/local/Cellar/gcc/5.3.0/x86_64-apple-darwin15.2.0/include -isystem /usr/local/Cellar/gcc/5.3.0/x86_64-apple-darwin15.2.0/sys-include   
checking for suffix of object files... configure: error: in `/private/tmp/gcc20160131-67124-kpenwb/gcc-5.3.0/build/x86_64-apple-darwin15.2.0/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[1]: *** [stage1-bubble] Error 2
make: *** [bootstrap] Error 2

READ THIS: https://git.io/brew-troubleshooting

These open issues may also help:
brew reinstall gcc --without-multilib error https://github.com/Homebrew/homebrew/issues/48212
brew install gcc --without-multilib stucks during 'make bootstrap' https://github.com/Homebrew/homebrew/issues/48612
gcc: warning: couldn't understand kern.osversion '15.0.0 https://github.com/Homebrew/homebrew/issues/48623
graphicsmagick fails to compile with gcc-5 in superenv https://github.com/Homebrew/homebrew/issues/48402
gcc failed to build on 10.6.8 https://github.com/Homebrew/homebrew/issues/47741
apple-gcc42 takes priority over modern gcc https://github.com/Homebrew/homebrew/issues/41055
gcc causes false alarms in C++ stdlib check https://github.com/Homebrew/homebrew/issues/45218
gcc 4.9.2 fails to produce debugging information https://github.com/Homebrew/homebrew/issues/34976
Object files deleted during build of gcc needed by gdb https://github.com/Homebrew/homebrew/issues/35734
MacOS.(gcc|clang|llvm)_version can return nil https://github.com/Homebrew/homebrew/issues/18781.

要解决此问题,有没有办法完全删除GCC然后再安装它?或者还有其他解决方案吗?请帮帮我!

1 个答案:

答案 0 :(得分:1)

brew unlink gcc应该足以让它脱离你的默认路径,所以你将回到Xcode的默认gcc(假设你已经安装了它)。重建gcc后,您可以通过运行brew link gcc来恢复取消关联。