如何使用Homebrew在macOS Mojave(10.14)上安装Valgrind? [英] How to install Valgrind on macOS Mojave(10.14) with Homebrew?
问题描述
我尝试使用命令brew install Valgrind
安装Valgrind,并且收到一条消息,内容为"valgrind:由于上游不兼容,此公式无法在比Sierra更高的macOS版本上编译或正常运行.
错误:无法满足的要求导致此构建失败."
I tried to install Valgrind with command brew install Valgrind
and I get a message says "valgrind: This formula either does not compile or function as expected on macOS versions newer than Sierra due to an upstream incompatibility.
Error: An unsatisfied requirement failed this build."
我尝试使用命令brew intall --HEAD Valgrind
安装,成功安装依赖项autoconf,automake和libtool后,当尝试安装valgrind时,出现配置错误:
"Valgrind可在Darwin 10.x,11.x,12.x,13.x,14.x,15.x,16.x和17.x(Mac OS X 10.6/7/8/9/10/11和macOS 10.12/13)"
我的操作系统是macOs Mojave(10.14),这是否意味着我目前无法在Homebrew上安装正常运行的Valgrind?
I tried to install with the command brew intall --HEAD Valgrind
instead, after successfully installed the dependencies autoconf, automake and libtool, when it tries to install valgrind, I get a configure error:
"Valgrind works on Darwin 10.x, 11.x, 12.x, 13.x, 14.x, 15.x, 16.x and 17.x (Mac OS X 10.6/7/8/9/10/11 and macOS 10.12/13)"
My OS is macOs Mojave(10.14), so does it mean that I can't install a functioning Valgrind with Homebrew presently?
推荐答案
$ git clone https://github.com/Echelon9/valgrind.git
$ cd valgrind
$ git checkout feature/v3.14/macos-mojave-support-v2
$ ./autogen.sh
$ ./configure --prefix=/where/you/want/it/installed --enable-only64bit
$ make
如果出现以下错误:No rule to make target '/usr/include/mach/mach_vm.defs’
,则需要运行xcode-select --install
.如果尚未安装Xcode,则可能需要从应用程序商店安装Xcode.完成后,您将需要编辑coregrind/Makefile
:
If you get the following error: No rule to make target '/usr/include/mach/mach_vm.defs’
, you will need to run xcode-select --install
. You might need to install Xcode from the app store if you don't already have it. Once that's done, you will need to edit the coregrind/Makefile
:
搜索:
am__append_19 = \
/usr/include/mach/mach_vm.defs \
/usr/include/mach/task.defs \
/usr/include/mach/thread_act.defs \
/usr/include/mach/vm_map.defs
仔细检查以下文件夹是否存在,在每行前添加:
After double checking the below folder exists, prefix every line with:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
最终结果应为:
am__append_19 = \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/mach/mach_vm.defs \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/mach/task.defs \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/mach/thread_act.defs \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/mach/vm_map.defs
现在再次运行make
,应该找到包含文件.但这并不一定意味着它将进行编译.我收到以下错误:
Now run make
again and the includes should be found. But that doesn't necessarily mean it will compile. I got the following error:
vg_preloaded.c:136:19: error: expected ';' before 'const'
__private_extern__ const char *__crashreporter_info__ = "Instrumented by Valgrind " VERSION;
对此的一种解决方法是添加以下行:
A fix for this is to add the following line:
#define __private_extern__ extern
到以下文件:
-
coregrind/m_syscall.c
-
coregrind/m_syswrap/syswrap-darwin.c
-
coregrind/vg_preloaded.c
coregrind/m_syscall.c
coregrind/m_syswrap/syswrap-darwin.c
coregrind/vg_preloaded.c
最后,您需要动动手指,希望不会出现其他错误:
Finally, you need to cross your fingers hoping no other errors show up:
$ make
$ make install
这篇关于如何使用Homebrew在macOS Mojave(10.14)上安装Valgrind?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!