【问题标题】:Building valgrind on OS X在 OS X 上构建 valgrind
【发布时间】:2018-02-13 11:13:58
【问题描述】:

我试图在 macOS Sierra(版本 10.12.6)上安装 valgrind。在运行 ./configure.sh 时,出现了这个错误:

正在检查受支持的 gcc 版本... 配置为: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 配置:--prefix=/Library/Developer/CommandLineTools/usr --with -gxx-include-dir=/usr/include/c++/4.2.1 no (applellvm-8.1.0) configure: error: please use gcc >= 3.0 or clang >= 2.9 or icc >= 13.0

所以,我检查了我的 gcc 和 clang 版本。回复如下:

Ankits-MacBook-Air:valgrind ankitshubham$gcc --version

已配置 与:--prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM 版本 8.1.0 (clang-802.0.42) 目标:x86_64-apple-darwin16.7.0 线程模型:posix 安装目录:/Library/Developer/CommandLineTools/usr/bin

Ankits-MacBook-Air:valgrind ankitshubham$clang --version

苹果 LLVM 版本 8.1.0 (clang-802.0.42) 目标:x86_64-apple-darwin16.7.0 线程模型:posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

我不知道如何检查 icc>=13.0

这里有什么问题?

【问题讨论】:

    标签: macos gcc valgrind


    【解决方案1】:

    您遇到的问题已在当前的开发仓库中解决。

    如果您确实想构建 valgrind 而不仅仅是使用包管理器,请克隆开发 repo(说明如下)。我假设您不是在寻找特定版本的 valgrind,以下说明将构建截至本文发布之日的 3.14 版本。

    我假设您刚刚下载了release 压缩包。 如果您改为克隆 repository page 上列出的 git 存储库,它将在 Mac 10.12.6 上正常构建

    来自 valgrind 存储库页面。

    从当前存储库克隆代码(匿名、只读 git 访问),这样做:

    git clone git://sourceware.org/git/valgrind.git 来构建克隆的 代码,按照克隆应该的 README 文件中的说明进行操作 给你。或者,以下应该可以工作:

      cd valgrind
      ./autogen.sh
      ./configure --prefix=...
      make
      make install
    

    截至本文发布之日,上述步骤运行良好,运行 MacOS 10.12.6 并安装了以下版本的 clang。

        clang --version
    Apple LLVM version 9.0.0 (clang-900.0.37)
    Target: x86_64-apple-darwin16.7.0
    Thread model: posix
    InstalledDir: ...
    

    【讨论】:

    • 我发现我使用的mac没有autogen.sh中调用的工具,例如aclocal。我发现这个要点很有帮助:gist.github.com/justinbellamy/2672db1c78f024f2d4fe 我准备好了。
    • 我在 High Sierra 上也遇到了这个问题,但上面的脚本(来自@MartinD 的评论)对我没有帮助。相反,我从自制软件 (brew install automake) 安装了 automake,但由于 High Sierra 取消了真正的 root 权限,我还必须调整安装位置并再次链接它,如本文所述(参见 @Pro 的 4 月 12 日回答)[ stackoverflow.com/a/49805417/2340582]
    【解决方案2】:

    对于像这样的任何流行的跨平台软件包,通常使用 Homebrew 之类的软件包管理器安装会更容易。然后你只需 brew install valgrind 就完成了。

    另请注意,clang 和 Apple 开发人员工具已经拥有类似的有用调试工具,尤其是 clang 的地址清理程序和 malloc 调试工具 - 这可以从 Xcode 的项目设置中轻松访问:

    但如果需要,您也可以从命令行使用它。

    【讨论】:

    • 确实如此。实际上,我正在关注一个网络教程,其中安装 valgrind 是其中一个步骤,他们以老式的方式进行了操作。
    • 是的,使用例如Homebrew 是其他人已经为您解决了所有配置/构建/安装问题并将它们放入脚本中。
    • 这不适用于 High Sierra:“valgrind:由于上游不兼容,此公式无法编译或在高于 Sierra 的 macOS 版本上按预期运行。错误:未满足的要求使此构建失败。 "
    【解决方案3】:

    按照以下步骤操作:

    git clone git://sourceware.org/git/valgrind.git &&
    cd valgrind &&
    ./autogen.sh &&
    ./configure &&
    make &&
    make install
    

    【讨论】:

      猜你喜欢
      • 2014-04-09
      • 1970-01-01
      • 2012-12-17
      • 1970-01-01
      • 2014-10-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多