I was trying to install valgrind on macOS Sierra (version 10.12.6). While running ./configure.sh, this error showed up:
checking for a supported version of gcc... Configured with:
--prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 no (applellvm-8.1.0) configure: error: please use gcc >= 3.0 or clang >= 2.9 or icc >= 13.0
So, I checked my gcc and clang version. The responses are as follows:
Ankits-MacBook-Air:valgrind ankitshubham$
gcc --version
Configured
with: --prefix=/Library/Developer/CommandLineTools/usr
--with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 8.1.0 (clang-802.0.42) Target: x86_64-apple-darwin16.7.0 Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Ankits-MacBook-Air:valgrind ankitshubham$
clang --version
Apple LLVM
version 8.1.0 (clang-802.0.42) Target: x86_64-apple-darwin16.7.0
Thread model: posix InstalledDir:
/Library/Developer/CommandLineTools/usr/bin
I don't know how to check if icc>=13.0
What is wrong here?
With any popular cross-platform package like this it's usually easier to just install with a package manager such as Homebrew. Then you just brew install valgrind
and you're done.
Note also that clang and the Apple developer tools already have similar useful debugging tools, particularly clang's address sanitizer and the malloc debug stuff - this is easily accessible from within Xcode's project settings:
but you can also use it from the command line if needed.
The issue you are running into has been solved in the current development repo.
If you do want to build valgrind instead of just using a package manager clone the development repo (instructions are below). I am assuming that you are not looking for a specific version of valgrind, the instructions below will build version 3.14 as of the date of this post.
I am making the assumption that you just downloaded the release tarball.
If you instead clone the git repository listed on the repository page it will build just fine on Mac 10.12.6
From the valgrind repository page.
To clone code from the current repository (anonymous, read-only git
access), do this:
git clone git://sourceware.org/git/valgrind.git To build the cloned
code, follow the instructions in the README file that the clone should
give you. Alternatively, the following should work:
cd valgrind
./autogen.sh
./configure --prefix=...
make
make install
The above steps work fine as of the date on this post running MacOS 10.12.6 with the following version of clang installed.
clang --version
Apple LLVM version 9.0.0 (clang-900.0.37)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: ...
Follow these steps:
git clone git://sourceware.org/git/valgrind.git &&
cd valgrind &&
./autogen.sh &&
./configure &&
make &&
make install