Reputation: 33430
Every time I try to run valgrind
on my OS X 10.8 notebook, I get:
bad executable (no stack)
valgrind: ./a.out: cannot execute binary file
What is the problem? How can I fix this? Everything works fine on Linux, so it's not that I'm somehow misusing valgrind
. The exact line I'm using is valgrind --tool=memcheck --leak-check=full ./a.out
.
Upvotes: 7
Views: 3237
Reputation: 2458
I had this problem using valgrind with macports. It turns out I needed to install with
sudo port install valgrind +universal
I was trying to valgrind a 32bit executable and I believe that without +universal, 32bit support was not being compiled in.
Upvotes: 3
Reputation: 222388
I was getting the same error, but I just upgraded valgrind to 3.8.1
(brew upgrade valgrind
using HomeBrew for me), and it works, although running Valgrind prints the following warning:
WARNING: Support on MacOS 10.8 is experimental and mostly broken.
WARNING: Expect incorrect results, assertions and crashes.
WARNING: In particular, Memcheck on 32-bit programs will fail to
WARNING: detect any errors associated with heap-allocated data.
Upvotes: 8