Oct 29, 2010

valgrind and the "failed to start tool 'memcheck'..." error

I've just decided to update valgrind with the latest version and got the following error:
"failed to start tool 'memcheck' for platform 'amd64-linux': No such file or directory"

It looks like the error is pretty much famous. I saw it also on some machines we use at work. I actually desperately needed valgrind, therefore decided to find out what the problem is.

Checking $PATH and $LD_LIBRARY_PATH didn't help - everything was fine. But what really helped is this message, which I should have read before installing valgrind :)

Important!  Do not move the valgrind installation into a place
different from that specified by --prefix at build time.  This will
cause things to break in subtle ways, mostly when Valgrind handles
fork/exec calls
(valgrind's README file)

But you know, I didn't really moved the installation. What I did was just configure and make, but after that I reconfigured it with prefix and didn't issued "make distclean" before reconfiguring :)

So, the recipe is simple. 
If you do "./configure" -- > "make install", than it should be just fine.
But if you do "./configure" -- > "make" -- > "./configure --prefix=..." -- > "make install", than most probably you will get this error message, see the subject.

Well you built valgrind and changed your mind later with the prefix, than don't forget to "make distclean" the source.

Hope it helps and you will not loose hours looking for reasons of the error ;)