7

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?

Jens Gustedt
  • 76,821
  • 6
  • 102
  • 177
Ankit Shubham
  • 2,989
  • 2
  • 36
  • 61

3 Answers3

6

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: ...
Shane
  • 657
  • 6
  • 21
  • I've found that the mac I was using did not have the tools called in autogen.sh, for example aclocal. I've found this gist helpful: https://gist.github.com/justinbellamy/2672db1c78f024f2d4fe and I was ready to go. – MartinD May 01 '18 at 10:05
  • I ran in to this problem as well on High Sierra but the above script (from @MartinD's comment) did not help me. Instead, I installed automake from homebrew (`brew install automake`) but since High Sierra takes away true root priveledges I also had to adjust the install location and link it again, as described in this post (see the April 12 answer by @Pro) [https://stackoverflow.com/a/49805417/2340582] – Jess the Mess Jun 12 '18 at 21:45
0

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:

enter image description here

but you can also use it from the command line if needed.

Paul R
  • 208,748
  • 37
  • 389
  • 560
  • True indeed. Actually I was following a web tutorial in which installing valgrind was one of the steps and they did it the old-fashioned way. – Ankit Shubham Sep 05 '17 at 08:41
  • 1
    Yes, the beauty of using e.g. Homebrew is that someone else has already solved all the configure/build/install issues for you and put them in a script. – Paul R Sep 05 '17 at 08:43
  • 3
    This does not work with High Sierra: "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." – tzachs Jan 21 '18 at 20:04
0

Follow these steps:

git clone git://sourceware.org/git/valgrind.git &&
cd valgrind &&
./autogen.sh &&
./configure &&
make &&
make install
wair92
  • 446
  • 11
  • 24