Wednesday, June 15, 2011

valgrind - dowloading, building and installing

First, I need to post all the links that will allow you to get to the creators information:

* WWW: http://valgrind.org
* Manual: http://valgrind.org/docs/manual/valgrind_manual.pdf
* Source: http://valgrind.org/downloads
* Building Instruction: http://valgrind.org/docs/manual/dist.readme.html

Building
* Download the source and put into your home account. Let's assume it is the valgrind-3.6.1 version.
Run these commands:

vver=valgrind-3.6.1
tar xf $vver.tar.bz2
cd $vver
ulimit -u 100 # ./configure has a bug ...
./configure --prefix=$HOME/valgrind # You need that in order to run make install without root privileges
make
make install
cd $HOME/valgrind/bin
./valgrind ls -l # see if it bombs out. If it does not you are good to go


Now, what you have is a $HOME/valgrind directory. If this is place where you want to use it then you are ready. The only one thing you need to do is set your path: export PATH=$HOME/valgrind/bin:$PATH

Ok... and what about if you need this valgrind now on a machine that does not have gcc?
The only thing you need to do is to pack the whole $HOME/valgrind directory, and copy it over to the destination machine.
The only caveat is that it has to be put into exactly the same directory as it was built in or else you will see this nice message:
valgrind: failed to start tool 'memcheck' for platform 'amd64-linux': No such file or directory

Solution - ln -s $HOME/valgrind path-to-valgrind-on-the-build-machine
Example: ln -s $HOME/valgrind /home/myhome/valgrind

No comments: