用brew安装valgrind和/或gdb?

时间:2014-09-04 14:44:47

标签: 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: 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。

3 个答案:

答案 0 :(得分: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版本。

答案 1 :(得分: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

答案 2 :(得分:0)

您应该可以使用brew来执行此命令在Yosemite上安装valgrind:brew install --HEAD valgrind,最糟糕的是您可能需要先执行以下设置命令:HOMEBREW_CC = gcc-4.5 HOMEBREW_CXX = g ++ - 4.5 brew

相关问题