Installing Valgrind on Shared Hosting

So you want to tinker with the goodness that is Valgrind, but you want to do it on a shared host? No problem.

# grab the latest valgrind
curl -O http://valgrind.org/downloads/valgrind-3.7.0.tar.bz2

#run an md5sum and check it matches the one listed on the downloads page
md5sum valgrind-3.7.0.tar.bz2

#unpack the puppy
tar -xjvf valgrind-3.7.0.tar.bs2

cd valgrind-3.7.0

#configure and pass in a directory you have permission to
./configure --prefix=$HOME/opt

#make valgrind
make

#install it - will end up in directory specified above
make install

Now you should have a bunch of files under your $HOME/opt directory. If you try to run it now, you'll probably end up with an error something like

valgrind: failed to start tool 'memcheck' for platform 'blahblah-linux': No such file or directory

No problem - open up your .bash_profile (in your home directory) and add this in somewhere:

VALGRIND_LIB="$HOME/opt/lib/valgrind"
export VALGRIND_LIB

Finally, reload your .bash_profile - either log out and in again or simply

source .bash_profile
</code>