【问题标题】:Installing valgrind and/or gdb with brew?用 brew 安装 valgrind 和/或 gdb?
【发布时间】:2015-09-13 19:09:54
【问题描述】:

我在使用 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 上。

【问题讨论】:

    标签: gdb valgrind homebrew


    【解决方案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 版本。

    【讨论】:

    • 当我输入which gcc 时,我得到/usr/bin/gcc,当我输入gcc -v 时,我得到gcc version 4.9.0 (Homebrew gcc49 4.9.0) 你是这个意思吗?我错过了什么吗?
    • 看来自制软件正在使用它在某处找到的 gcc 4.2。你有什么版本的brew?你在某处安装了 gcc 4.2 吗?
    • 我正在使用 brew 0.9.5,我认为 brew install gcc 4.2 当我执行 brew install gcc 但我不知道如何删除它...
    【解决方案2】:

    答案就在这里

    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

    【讨论】:

      【解决方案3】:

      您应该能够使用 brew 在 Yosemite 上执行以下命令来安装 valgrind: brew install --HEAD valgrind 在最坏的情况下您可能需要先执行这些设置命令:HOMEBREW_CC=gcc-4.5 HOMEBREW_CXX=g++-4.5 brew

      【讨论】:

        猜你喜欢
        • 2018-06-16
        • 2014-01-23
        • 1970-01-01
        • 2016-08-24
        • 1970-01-01
        • 2017-04-19
        • 2014-01-21
        • 1970-01-01
        • 2020-12-29
        相关资源
        最近更新 更多