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 ;)

21 comments:

이정승 said...

Good! That's the one I want.

Anar Manafov said...

I'm glad I could help ;)

大博 said...

A big help for me ~
thanks !

Guna said...

Cool :) I would have wasted many hours.

Alexey said...

Specifying --libdir in addition to --prefix was the only thing that helped me to get rid of the error.

Daniel Marjamäki said...

Thanks! I did exactly the same mistake.

vinayjan said...

thanks soo much

RPS said...

This is good info. Unfortunately, I'm also getting this error from a repository version, which does not provide the option of choosing compilation options. A simple "apt-get install valgrind" in Ubuntu 12.04 gives the same error. Might be time to revert to compiling source...

Anar Manafov said...

Can it be that you have several versions of valgrind installed?

Anonymous said...

Saved my day

Anonymous said...

Worked for me! Thank you!

Anonymous said...

Thanks Man...I really appreciate.. I installed valgrind on one system and wanted to run on another. I copied the exe and it gave the same error.
Then this post helped. I copied the exe in the same directory path as where I installed valgring and it worked...

Anar Manafov said...

I'm glad it helped ;)

Kyle said...

Awesome! You saved my day!

David said...

This saved me half a day of debugging! Thank you!!!

Anonymous said...

thank you so much for putting that on the internet

Anonymous said...

exactly what I did...configure and then configure with prefix..thank you!

vmw said...

Just here to reiterate what the everyone else said... thanks, you saved me a load of time.

Unknown said...

Thanks for the info. It saved my time :)

Anonymous said...

saved time here

Anonymous said...

very helpful. thanks.