valgrind mac os sierra 10.12.1

Glement picture Glement · Dec 1, 2016 · Viewed 11.6k times · Source

Is there any possible ways to install valgrind on new Mac OS? brew tell

brew install -HEAD valgrind
valgrind: This formula either does not compile or function as expected on macOS
versions newer than El Capitan due to an upstream incompatibility.
Error: An unsatisfied requirement failed this build.

valgrind ls -l
valgrind: mmap-FIXED(0x0, 253952) failed in UME (load_segment1) with error 12 (Cannot allocate memory).

Answer

Joost Huizinga picture Joost Huizinga · Apr 16, 2017

It seems that people are working on trying to get Valgrind to work on MAC OS X 10.12, the most relevant thread of which can be found here: https://bugs.kde.org/show_bug.cgi?id=365327.

The last post includes a patch to revision 16297, which is supposed to provide at least some basic functionality. The patch can be found here: https://bugsfiles.kde.org/attachment.cgi?id=104964.

Obviously this patch is still very much in development, and the author (Louis Brunner) has stated that it is incomplete, the relevant excerpt being:

"I have been working on a patch to support macOS Sierra. At the moment, it works for a variety of programs (python, GIMP, most basic commands like ls, mkdir) but it is still incomplete (warnings in dyld, libsystem_kernel... crash for some GUI programs)."

However, if you, like me, are willing to risk an incomplete version, the installation instructions are as follows:

First, install automake and svn, if those are not already installed on your system. After that, you should be able to build and install Valgrind on MAC OS X 10.12 with the following instructions:

svn checkout -r 16297 svn://svn.valgrind.org/valgrind/trunk
cd trunk
curl https://bugsfiles.kde.org/attachment.cgi?id=105218 > patch.txt
svn patch patch.txt
./autogen.sh
./configure
make
make install

If it doesn't work for your use-case, the only solution is probably to wait until the kinks have been worked out.

Edit: a newer patch can be found here: https://bugsfiles.kde.org/attachment.cgi?id=105218. I have updated the code above with the new patch. While still showing numerous warnings, valgrind now works with "ls", "ls -l", a simple "hello_world" program, and the program that prompted me to download valgrind in the first place.