2

I'm running valgrind on two very simple 'hello world' programs. They are both returning the same error:

laptop$ g++ hello.cpp -o hello 
laptop$ valgrind ./hello
Killed: 9
laptop$ g++ hello2.cpp -o hello2
laptop$ valgrind ./hello2 
Killed: 9

My hello2.cpp looks like this:

#include <stdio.h>
int main(void)
{
    printf("main.c\n");
    return 0;
}

The other hello world program simply uses cout from iostream instead of printf(). One important thing to note is that valgrind works as expected on Ubuntu server 14.04, and these failing examples are on my new Macbook Pro running OSX 10.10. I've searched around and everything I find is relating to large programs with complex memory issues.

Why am I getting this error on my Mac?

s g
  • 5,289
  • 10
  • 49
  • 82

3 Answers3

2

Whilst it may have been the case in past OS X release cycles that Valgrind took a period of time before achieving reasonable feature support, basic OS X 10.10 and OSX 10.11 support is already available in Valgrind trunk due to significant recent work.

From the mailing list:

There has been some effort recently to improve Valgrind's support for Yosemite. If you develop on Mac OS, you might like to try out the trunk (svn co svn://svn.valgrind.org/valgrind/trunk) and report any breakage you get. Support for Yosemite is good enough that at least one large graphical application (Firefox) runs OK. Support for the previous release, 10.9 (Mavericks), is also substantially improved.

Note that the work has targetted 64 bit processes only. 32 bit might work, and probably better on Mavericks, but I suspect it will be increasingly problematic on Yosemite due to Valgrind's 32 bit x86 instruction set support not having progressed passed SSSE3.

Julian Seward

http://sourceforge.net/p/valgrind/mailman/message/33047840/

Full disclosure: I'm one of the new Valgrind developers who contributed patches to support OS X 10.10 and OS X 10.11

e76d587d9
  • 994
  • 5
  • 14
1

See this answer. Short version:

brew install --HEAD valgrind
Community
  • 1
  • 1
Sebastian Graf
  • 3,602
  • 3
  • 27
  • 38
0

Using a package manager (such as apt-get) to install valgrind on OSX 10.10 is unreliable. Download and build from source using the following link:

http://ranf.tl/2014/11/28/valgrind-on-mac-os-x-10-10-yosemite/

s g
  • 5,289
  • 10
  • 49
  • 82