How to install Valgrind on macOS Mojave(10.14) wit

2020-02-02 04:19发布

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."

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?

9条回答
2楼-- · 2020-02-02 04:55

addition: I found this one worked for me on my OSX 10.14

brew install --HEAD https://raw.githubusercontent.com/LouisBrunner/valgrind-macos/master/valgrind.rb

A branch that is working to get OSX correct. something to tide us over until we get a real valgrind version fixed.

查看更多
聊天终结者
3楼-- · 2020-02-02 04:42

I have just found a working solution to use VALGRIND on my Mac (Mojave 10.14.6). Just run this command :

brew install --HEAD https://raw.githubusercontent.com/LouisBrunner/valgrind-macos/master/valgrind.rb

(From https://github.com/LouisBrunner/valgrind-macos)

Hope it will work for you.

查看更多
疯言疯语
4楼-- · 2020-02-02 04:44

You may use Experimental Version of Valgrind for macOS 10.14.5 Mojave at:

https://github.com/sowson/valgrind

The command to use it is:

brew install --HEAD https://raw.githubusercontent.com/sowson/valgrind/master/valgrind.rb

It is still experimental and needs some work but for simple projects works already... Enjoy!

查看更多
一纸荒年 Trace。
5楼-- · 2020-02-02 04:46

Works on Mojave 10.14 :

brew install --HEAD https://raw.githubusercontent.com/LouisBrunner/valgrind-macos/master/valgrind.rb
查看更多
走好不送
6楼-- · 2020-02-02 04:57

Not a proper solution for macOs, but for the time being, I created a docker image. After installing docker for macOS, this is how to start valgrind:

cd </path/to/source/directory/where/you/want/run/valgrind/with>
curl -O https://raw.githubusercontent.com/biocyberman/ValgrindDocker/master/startValgrind
./startValgrind # this will takes time for the first time, because it needs to fetch docker valgrind image
# you will get a root command prompt inside the docker image. 
# do what ever you want
# type 'exit' to quit
查看更多
ら.Afraid
7楼-- · 2020-02-02 04:59

You can follow alex.m's answer to get valgrind, but if you'r using it on a int main() { return 0; } program, you'll get many weird errors, and non-existing allocs / free.

To 'hide' theses annoying errors, you can follow theses steps (it's more a workaround than a real fix) (based on this wiki page and some research in valgrind source code):

  • First, create and compile a int main() { return 0; } program.
  • Execute the following command (to create file containing errors supression):

valgrind --leak-check=full --show-reachable=yes --error-limit=no --gen-supressions=all --log-file=minimalraw.log ./minimal

cat ./minimalraw.log | ./parse_valgrind_suppressions.sh > minimal.supp

  • Copy and Past minimal.supp content at the end of $YOUT_VALGRIND_INSTALLATION_PATH$/lib/default.supp file

And you are done! Errors your be ignored. If you also want's to remove the non-existing allocs, frees etc, you can directly edit valgrind's source code. Or juste use heapusage for leak-tracking

查看更多
登录 后发表回答