2014-09-04 54 views
0

我在使用brew安裝valgrind時遇到了一些麻煩。我使用的命令:用brew安裝valgrind和/或gdb?

brew install valgrind 

,並得到錯誤

==> ./configure --prefix=/usr/local/Cellar/valgrind/3.9.0 --enable-only64bit -- build=amd64-darwin 
checking for gcc... gcc-4.2 
checking whether the C compiler works... no 
configure: error: in `/private/tmp/valgrind-bA4juk/valgrind-3.9.0': 
configure: error: C compiler cannot create executables 
See `config.log' for more details 

READ THIS: https://github.com/Homebrew/homebrew/wiki/troubleshooting 

我得到使用gdb

==> Downloading http://ftpmirror.gnu.org/gdb/gdb-7.7.1.tar.gz 
Already downloaded: /Library/Caches/Homebrew/gdb-7.7.1.tar.gz 
==> ./configure --prefix=/usr/local/Cellar/gdb/7.7.1 --with-system-readline --with-python=/usr 
checking for gcc... gcc-4.2 
checking for C compiler default output file name... 
configure: error: in `/private/tmp/gdb-6Ivx9u/gdb-7.7.1': 
configure: error: C compiler cannot create executables 
See `config.log' for more details. 

READ THIS: https://github.com/Homebrew/homebrew/wiki/troubleshooting 
If reporting this issue please do so at (not Homebrew/homebrew): 
    https://github.com/homebrew/homebrew-dupes/issues 

類似的錯誤但是C編譯器是

$ cc -v 
Using built-in specs. 
COLLECT_GCC=cc 
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc49/4.9.0/libexec/gcc/x86_64-apple-darwin13.3.0/4.9.0/lto-wrapper 
Target: x86_64-apple-darwin13.3.0 
Configured with: ../configure --build=x86_64-apple-darwin13.3.0 --prefix=/usr/local/Cellar/gcc49/4.9.0 --enable-languages=c,c++,objc,obj-c++ --program-suffix=-4.9 --with-gmp=/usr/local/opt/gmp4 --with-mpfr=/usr/local/opt/mpfr2 --with-mpc=/usr/local/opt/libmpc08 --with-cloog=/usr/local/opt/cloog018 --with-isl=/usr/local/opt/isl011 --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --disable-werror --with-pkgversion='Homebrew gcc49 4.9.0' --with-bugurl=https://github.com/Homebrew/homebrew-versions/issues --enable-plugin --disable-nls --enable-multilib 
Thread model: posix 
gcc version 4.9.0 (Homebrew gcc49 4.9.0) 

有誰知道可能是什麼出錯了?我在OS X 10.9.4上。

回答

1
checking for gcc... gcc-4.2 
gcc version 4.9.0 (Homebrew gcc49 4.9.0) 

來自brew和手動運行的輸出顯示了2個獨立版本的gcc,並且brew正在拾取真正的舊版本。設置您的環境,以便which gcc返回4.9版本。

+0

當我輸入 '這gcc' 我得到 '在/ usr/bin中/ gcc' 當我鍵入'GCC -v'我得到 'gcc版本4.9.0(家釀gcc49 4.9.0)' 你是這個意思嗎?我錯過了什麼嗎? – 2014-09-04 21:40:53

+0

看來,自制軟件正在使用gcc 4.2找到某處。你有什麼版本的釀造?你有沒有安裝gcc 4.2的地方? – ventsyv 2014-09-04 22:03:31

+0

我正在使用brew 0.9.5,並且我認爲brew安裝gcc 4.2時,我已經'brew install gcc',但我不知道如何刪除它... – 2014-09-04 22:41:24

0

答案就在這裏

Using Homebrew with GCC-4.6

我通過安裝

HOMEBREW_CC=gcc-4.9 HOMEBREW_CXX=g++-4.9 brew install gdb

HOMEBREW_CC=gcc-4.9 HOMEBREW_CXX=g++-4.9 brew install valgrind

0

你應該b解決了這個問題使用brew:brew install -HEAD valgrind可以執行以下命令來安裝valgrind:在最糟糕的情況下,您可能需要先執行以下這些設置命令:HOMEBREW_CC = gcc-4.5 brew