2016-02-01 179 views
-1

我最近完全搞砸了GCC,试图让它与openMP一起工作。现在,GCC甚至不能编译/运行一个简单的“helloworld”程序。当我输入“gcc helloworld.c -o Result”时,它给了我一个“ld:library for -lgcc”的错误。是否可以从我的Mac中完全删除GCC?如果是这样,我该怎么做?

我每次尝试安装gcc /通过执行类似 GCC通过--without-multilib的重新安装GCC,它给了我这样的事情:

==> 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,然后再安装一次?或者有其他解决方案吗?请帮帮我!

+0

您使用的是xcode吗?如果您卸载/重新安装xcode,我相信GCC安装包含在xcode目录结构中。无论如何,它在我的机器上。 – LuvnJesus

+0

@LuvnJesus yup!只是卸载Xcode,显然GCC仍然在这里根据“gcc --version” – somanyerrorswhy

+0

刚刚发现这...也许这将帮助你:http://stackoverflow.com/questions/28475708/uninstalling-gcc-completely-in- mac-os-x-yosemite – LuvnJesus

回答

0

brew unlink gcc应该足以让它离开你的默认路径,所以你会回到Xcode的默认gcc(假设你已经安装了)。一旦你重建了gcc,你可以通过运行brew link gcc来恢复取消链接。

相关问题