linux – How to install valgrind properly?

linux – How to install valgrind properly?

Short answer: Make from source.

How?

  1. Uninstall the non working valgrind version with root rights (eg. sudo):

apt-get --purge valgrind
or
dpkg --remove valgrind
or
yum remove valgrind

  1. Obtain sources from here.

  2. Identify the latest version (for example 3.17.0)

  3. Download sources : wget https://sourceware.org/pub/valgrind/valgrind-3.17.0.tar.bz2

  4. Decompress archive tar xvf valgrind-3.17.0.tar.bz2

  5. Go to uncompressed archive cd valgrind-3.17.0

  6. Configure ./configure

  7. Compile make

  8. Install make install (with root rights, eg. sudo)

Note: very useful for Raspberry Pi 4 users – Default valgrind installation generate a lot of internal errors. See Valgrind reports hundreds of errors in Hello World program on RaspberryPi 4B

All major linux distributions will include valgrind in their repositories. You can find this on debian derived, apt based systems with:

apt search valgrind

But first just try:

apt install valgrind

It should work, and pull in any dependencies. Remember, if you are not the superuser, youll need to preface those with sudo.

Its a great tool, have fun.

linux – How to install valgrind properly?

i think its due to dependency not met.
install g++
by

sudo apt-get install g++

then try again.
error is due to exec is unable to find any package named g++

Leave a Reply

Your email address will not be published.