【问题标题】:Yosemite and Valgrind优胜美地和瓦尔格林德
【发布时间】:2014-12-21 05:57:25
【问题描述】:

你能告诉我如何在 yosemite 上安装 valgrind 吗?当我尝试安装它时,我得到“正在检查内核版本......不支持(14.0.0) 配置:错误:Valgrind 适用于 Darwin 10.x、11.x、12.x 和 13.x (Mac OS X 10.6/7/8/9)"

没有官方路径或更新,我也没有找到任何东西(http://comments.gmane.org/gmane.comp.kde.devel.bugs/1553705 除外,但他们没有解决这个问题)。

【问题讨论】:

  • Known issuehomebrew 并带有不友好的注释:“由于上游的开发时间表,在不久的将来不太可能修复”
  • @hrbrmstr,谢谢,我通过在虚拟机上安装 Ubuntu,然后在 Ubuntu 上安装 valgrind 解决了这个问题一段时间

标签: macos valgrind osx-yosemite


【解决方案1】:

由于没有支持 Yosemite 的稳定版本,您可以使用

安装最新的开发版本
brew install --HEAD valgrind

【讨论】:

  • 此命令不再有效。我收到这条消息:Error: Failed to download resource "valgrind--patch" Download failed: https://gist.githubusercontent.com/jacknagel/cd26a902d72aabd0b51d/raw/1a61a328a87a728dccbeef0594f6fe335e9bf917/valgrind-sdk-paths-Makefile-am.diff
  • 虽然这在发布时是正确的解决方案,但 Valgrind 现在通过应用程序记录的发布渠道支持 OS X Yosemite。
【解决方案2】:

虽然在过去的 OS X 发布周期中,Valgrind 可能需要一段时间才能获得合理的功能支持,但由于在预发布 Yosemite 上的大量工作,Valgrind 主干中已经提供了基本的 OS X 10.10 支持。

来自邮件列表:

最近有一些努力改进 Valgrind 对 优胜美地。如果你在 Mac OS 上开发,你可能想试试 主干(svn co svn://svn.valgrind.org/valgrind/trunk)并报告任何 你得到的破损。对优胜美地的支持已经足够好,至少 一个大型图形应用程序 (Firefox) 运行正常。支持 之前的版本 10.9 (Mavericks) 也有了很大的改进。

请注意,该工作仅针对 64 位进程。 32位可能 工作,可能在小牛队更好,但我怀疑它会是 由于 Valgrind 的 32 位 x86,Yosemite 上的问题越来越多 指令集支持未通过 SSSE3。

朱利安·苏厄德

http://sourceforge.net/p/valgrind/mailman/message/33047840/

全面披露:我是为支持 OS X 10.10 贡献补丁的新 Valgrind 开发人员之一

【讨论】:

  • +1 为 valgrind 做出贡献。根据我的代码运行它。它指出了在过去 24 小时里一直让我抓狂的分段错误的原因,因为我找不到原因。
【解决方案3】:

Valerio 的 svn 工作流程会下载每个分支,这会耗费时间和资源。更好的方法是只下载主干:

svn co svn://svn.valgrind.org/valgrind/trunk valgrind
cd valgrind
./autogen.sh
./configure
make
make install

【讨论】:

  • 注意到下载它所花费的时间比发布源 .tar.bz 所做的要长得多...仅仅是压缩产生了如此大的差异,还是它实际上下载了文件,否则它不会? (我猜这可能是不同的服务器......或者svn cocurl之间的区别......)
  • +1:效果很好。我唯一改变的是我最后做了sudo make install而不是make install。不确定是否有必要,因为我没有按照你的方式尝试。
【解决方案4】:

这是我的看法。我或多或少有一个安装了 xcode 的干净 mac。 得到它的编译和运行以下内容:

# build/install autoconf/automake/libtool so that 'autogen' works
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz
tar -xzf autoconf-2.69.tar.gz 
cd autoconf-2.69
./configure && make && sudo make install
cd ..

curl -OL http://ftpmirror.gnu.org/automake/automake-1.14.tar.gz
tar -xzf automake-1.14.tar.gz
cd automake-1.14
./configure && make && sudo make install
cd..

curl -OL http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz
tar -xzf libtool-2.4.2.tar.gz
cd libtool-2.4.2
./configure && make && sudo make install
cd ..

svn co svn://svn.valgrind.org/valgrind/trunk valgrind
cd valgrind
./autogen.sh
# important: configure-params, otherwise make ends in errors 
./configure -disable-tls --enable-only64bit --build=amd64-darwin 
make
# sudo, otherwise it fails due to permissions 
sudo make install  

请注意,callgrind_control(来自 valgrind-3.11.0 SVN)似乎无法在 OS X 上运行,看起来像 perl 脚本,并且它运行的命令行工具 (vgdb -l) 打印出一些“意外”的内容脚本无法正确解析(因此它无法找到使用 valgrind 运行的其他进程)。

或者,perl 脚本只调用 vgdb,我们也可以直接这样做(只需手动计算您的 process-id):

vgdb --pid=2858 instrumentation on

【讨论】:

  • 太棒了,这正是我需要让 valgrind 在 Yosemite 10.10.4 上运行唯一的事情,上面表示 -disable-tls 开关的命令有一个 unicode 连字符, 而不是常规的 ascii 连字符。
  • 很高兴我能提供帮助 - 感谢您指出连字符(已更新)。还添加了 callgrind_control 问题的解决方法。
【解决方案5】:

在 10.10.1 为我工作:

svn co svn://svn.valgrind.org/valgrind
cd valgrind
./autogen.sh
./configure
make
make install

【讨论】:

  • 试过这个。下载了很多不相关的测试,我放弃了。
  • 从开发人员的角度来看,回归测试是 Valgrind 程序的重要组成部分。虽然最近对 OS X 平台支持的改进尚未发布正式的 Valgrind 版本,但不幸的是,您需要下载带有测试的版本。如果由于任何原因 SVN 下载对您的连接造成麻烦,那么有 非官方 GitHub 存储库:github.com/liquid-mirror/valgrind
【解决方案6】:

这里列出的所有解决方案对我来说都失败了。最终成功的是使用 mac 端口。

sudo port install valgrind-devel

【讨论】:

    【解决方案7】:

    这里是如何使用除官方 svn 之外的其他来源安装它(因为它似乎间歇性可用)。

    https://crispyappstudiosblog.wordpress.com/2015/07/07/installing-valgrind-on-osx-yosemite/

    1) 导航到这个 svn 的 git 镜像并下载最新的 可用版本:http://repo.or.cz/w/valgrind.git

    2) 你也需要 VEX,所以在这里获取最新版本: http://repo.or.cz/w/vex.git

    3) 提取它们。把VEX文件夹的全部内容 进入 valgrind 目录顶层名为 VEX 的文件夹。

    cd到valgrind目录下,执行如下:

    Run ./autogen.sh
    
    Run ./configure
    
    Run make
    
    Run sudo make install
    

    通过运行valgrind --version 测试它你应该运行在 至少 3.11.0 SVN 可以在 Yosemite 上运行。

    【讨论】:

      【解决方案8】:

      我通过安装 homebrew 将它安装在我的 mac 上,然后在终端中运行这 3 个命令。

      1. brew update
      2. brew doctor
      3. brew install --HEAD valgrind

      PS:我有 Os X El Capitan (10.11),但这也适用于以前的版本。

      【讨论】:

      • 任何比这更新的东西:valgrind: This formula either does not compile or function as expected on macOSversions newer than El Capitan due to an upstream incompatibility.
      【解决方案9】:

      我终于让 Valgrind 在我的 OSX El Capitan 10.11.12 上工作。

      在我安装 Xcode 命令行工具后,用户 Kalmiya 的回答首先对我有用。

      在终端输入:

      xcode-select --install

      现在按照 Kalmiya 的帖子一步一步来。 https://stackoverflow.com/a/30366798/3633475

      【讨论】:

      • 我的 mac book pro 已经更新了最新版本的 mac os,它是 10.11.3 而不是 10.11.12!你的建议也对我不起作用。这是错误Assertion 'tst->os_state.pthread - magic_delta == self' failed.
      • @S.M.Mousavi 在 SVN 开发版本中为 Valgrind 修复了“Assertion 'test->os_state.pthread - magic_delta == self'”错误。
      • @RhysKidd 非常感谢您的信息 :)
      【解决方案10】:

      这里是另一个关于 svn 安装的例子。以前的那些对我不起作用,因为我需要安装 automakeautoconf,但我没有安装,即使我安装了最新版本的 Xcode 命令行工具。

      我从this site 得到以下信息。在完成brew install automakebrew install autoconf 之后,我还必须通过brew link automakebrew link autoconf 来链接automakeautoconf 以使其工作。

      # Check out their repo...
      $ svn co svn://svn.valgrind.org/valgrind/trunk valgrind-trunk
      # and hop into it.
      $ cd valgrind-trunk
      
      # You need to have autoconf and automake installed to build Valgrind
      # This example uses Homebrew to install these dependencies
      # (MacPorts should also work)
      # (Permission error? add sudo!)
      $ brew install automake
      $ brew install autoconf
      
      # run autogen.sh in valgrind-trunk
      $ ./autogen.sh
      
      # Tricky, there are some hard wired paths in the Valgrind sources.
      # You need to symlink the mach folder in your XCode SDK to /usr/include/mach
      # Be sure to use the proper Xcode SDK "MacOSX10.10.sdk" in the path!
      $ ln -sv /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/mach /usr/include/mach
      
      # Run configure + set install paths in valgrind-trunk
      $ ./configure --prefix=/usr/local
      
      # Run Make and make install (permission error? add sudo!) in valgrind-trunk
      $ make
      $ make install
      
      # Check it works
      $ valgrind --version
      valgrind-3.11.0.SVN
      

      【讨论】:

      • 在 10.10.3 上仍然没有成功:$ make ... Making all in coregrind make[2]: *** No rule to make target '/usr/include/mach/mach_vm.defs', needed 'by m_mach/mach_vmUser.c'. Stop. make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 尽管 /usr/include/mach 是在 root 下创建的,并按照描述进行符号链接等。
      【解决方案11】:

      我已使用 kalmiya 的说明将 valgrind 构建为 OSX Yosemite 的 conda 包。对于那些使用 anaconda/conda 的人,只需这样做

      conda install -c https://conda.binstar.org/groakat valgrind
      

      旁注: 我需要安装如下所述的命令行工具来编译 valgrind。

      https://stackoverflow.com/a/30471647/2156909

      【讨论】:

        【解决方案12】:

        我在 Yosemite 上编译了 valgrind,但必须使用 hack 才能这样做。虽然我认为你应该使用xcode-select install 来获取所有命令行工具(之后 valgrind 应该正确制作),但如果你不想这样做(例如 Xcode 工具的大小太大),你也可以得到Darwin OSX 代码并将以下文件复制到/usr/include/mach

           mach_vm.defs
            task.defs
            thread_act.defs
            vm_map.defs
        

        这允许进行干净的编译和安装,但请注意这是一个相当松散的 hack。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2015-05-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2014-12-13
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多