使用brew安装valgrind和/或gdb?

使用brew安装valgrind和/或gdb?,gdb,valgrind,homebrew,Gdb,Valgrind,Homebrew,我在使用brew安装valgrind时遇到一些问题。我正在使用命令: 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

我在使用brew安装valgrind时遇到一些问题。我正在使用命令:

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) 
有人知道会出什么问题吗?我在OSX10.9.4上

checking for gcc... gcc-4.2
gcc version 4.9.0 (Homebrew gcc49 4.9.0)
brew的输出和手动运行显示了2个单独的gcc版本,brew正在使用真正的旧版本。设置您的环境,以便
哪个gcc
返回4.9版本。

答案在这里

我通过安装解决了这个问题

HOMEBREW\u CC=gcc-4.9 HOMEBREW\u CXX=g++-4.9 brew安装gdb


HOMEBREW\u CC=gcc-4.9 HOMEBREW\u CXX=g++-4.9 brew install valgrind
您应该能够使用brew:brew install--HEAD valgrind在约塞米蒂安装Valgrinde时执行此命令:brew\u CC=gcc-4.5 HOMEBREW\u CXX=g++-4.5 brew

当我键入
我得到哪个gcc
/usr/bin/gcc
当我键入
gcc-v
时,我得到了
gcc版本4.9.0(自制gcc49 4.9.0)
这就是你的意思吗?我遗漏了什么吗?看来homebrew正在使用gcc 4.2,它找到了一些地方。你们有什么版本的brew?您是否在某处安装了gcc 4.2?我正在使用brew 0.9.5,我认为brew在安装gcc时安装了gcc 4.2,但我不知道如何删除它。。。