How to install and build valgrind from source on Ubuntu 18.04?
21:08 17 Jun 2020

I installed Valgrind from the repository on Ubuntu 18.04, but it's version 3.13.0 and it does not recognize the latest AVX-512 instructions (such as the AVX mask register instructions). I need to install the latest version, which is not in the repository.

I have not installed from source on Linux before, so I got these (somewhat out of date) instructions from another Stack Overflow question:

wget https://sourceware.org/pub/valgrind/valgrind-3.16.0.tar.bz2
tar -xjf valgrind-3.16.0.tar.bz2
./configure --prefix=/usr/local
make
sudo make install
ccache --clear

The first two lines work, but ./configure --prefix=/usr/local returns

-bash: ./configure: No such file or directory.  

So I created a /configure folder and the same command now returns

-bash: ./configure: Is a directory

My questions are:

  1. When I download a version later than what's in the Ubuntu repository using wget, where should I store the download file? The main valgrind folder is /usr/lib/valgrind, but I don't think that's the right place.

  2. What are the steps to install Valgrind from source? The instructions above are not completely correct.

  3. Do I need to indicate where Valgrind should be installed, or does the install routine take care of that?

ubuntu valgrind