2016-02-01 209 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來恢復取消鏈接。

相關問題