How can I get Valgrind working on my mac? Mac specs: mid-2012 11" 2GHz i7 MacBook Air with macOS Sierra 10.12.5. FWIW,
brew install valgrind fails to build, as well as these steps from Zed Shaw's "Learn C The Hard Way" ex4:
# 1) Download it (use wget if you dont have curl) curl -O http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2 # use md5sum to make sure it matches the one on the site md5sum valgrind-3.12.0.tar.bz2 # 2) Unpack it. tar -xjvf valgrind-3.12.0.tar.bz2 # cd into the newly created directory cd valgrind-3.12.0 # 3) configure it ./configure # 4) make it make # 5) install it (need root) sudo make install
Valgrind also fails after modifying the file valgrind-3.12.0/coregrind/m_main.c line 4061 from:
#if defined(VGO_darwin) && DARWIN_VERS == DARWIN_10_10
...I was able to complete an installation of Valgrind (prior to changing m_main.c the
make error'd out) but unfortunately, now the simple test recommended in the README file for verifying the install is failing:
See if it works. Try "valgrind ls -l". Either this works, or it bombs out with some complaint.
$ valgrind ls -l valgrind: mmap-FIXED(0x0, 253952) failed in UME (load_segment1) with error 12 (Cannot allocate memory).
I'm not sure what exactly this means, so it would be great if someone could help parse the "complaint" and suggest a means to get a successful install of or alternative to Valgrind on macOS Sierra.
FWIW: per Valgrind's website announcement:
20 October 2016: valgrind-3.12.0 is available. This release supports: X86/Linux, AMD64/Linux, ARM32/Linux, ARM64/Linux, PPC32/Linux, PPC64BE/Linux, PPC64LE/Linux, S390X/Linux, MIPS32/Linux, MIPS64/Linux, ARM/Android, ARM64/Android, MIPS32/Android, X86/Android, X86/Solaris, AMD64/Solaris, X86/MacOSX 10.10 and AMD64/MacOSX 10.10. There is also preliminary support for X86/MacOSX 10.11/12, and AMD64/MacOSX 10.11/12. For more details see the release notes.
...and release notes:
Preliminary support for MacOS 10.12 (Sierra) has been added.
Per this solution: https://stackoverflow.com/a/43431715/5225057 I have also tried the following,
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
and am left with:
valgrind: mmap-FIXED(0x0, 253952) failed in UME (load_segment1) with error 12 (Cannot allocate memory).
UPDATE per thiagoveloso's answer:
$ man port $ port version Version: 2.4.1 $ sudo port install valgrind Password: ---> Computing dependencies for valgrind ---> Fetching archive for valgrind ---> Attempting to fetch valgrind-3.12.0_0.darwin_16.x86_64.tbz2 from http://mse.uk.packages.macports.org/sites/packages.macports.org/valgrind ---> Attempting to fetch valgrind-3.12.0_0.darwin_16.x86_64.tbz2 from http://lil.fr.packages.macports.org/valgrind ---> Attempting to fetch valgrind-3.12.0_0.darwin_16.x86_64.tbz2 from https://packages.macports.org/valgrind ---> Fetching distfiles for valgrind ---> Attempting to fetch valgrind-3.12.0.tar.bz2 from http://ykf.ca.distfiles.macports.org/MacPorts/mpdistfiles/valgrind ---> Attempting to fetch valgrind-3.12.0.tar.bz2 from https://distfiles.macports.org/valgrind ---> Verifying checksums for valgrind ---> Extracting valgrind ---> Applying patches to valgrind ---> Configuring valgrind ---> Building valgrind ---> Staging valgrind into destroot ---> Installing valgrind @3.12.0_0 ---> Activating valgrind @3.12.0_0 ---> Cleaning valgrind ---> Updating database of binaries ---> Scanning binaries for linking errors ---> No broken files found. $ valgrind --version valgrind-3.12.0 $ valgrind ls -l valgrind: mmap-FIXED(0x0, 253952) failed in UME (load_segment1) with error 12 (Cannot allocate memory).
per http://valgrind.org/docs/manual/dist.news.html valgrind 3.13.0 has improved support for macOS 10.12... hopefully this will be a workable solution.