Introduction to Valgrind
Valgrind is an instrumentation
framework for building dynamic analysis tools. There are Valgrind
tools that can automatically detect many memory management and
threading bugs, and profile programs in detail. Valgrind can also
be used to build new tools.
This package is known to build and work properly using an LFS-11.0
platform.
Package Information
Additional Downloads
Valgrind Dependencies
Optional
GDB-10.2 (for
tests), LLVM-12.0.1 (with Clang), and Which-2.21 (for tests)
User Notes: https://wiki.linuxfromscratch.org/blfs/wiki/valgrind
Installation of Valgrind
First, make several changes that are required for Valgrind to
function on systems with glibc-2.34 installed:
patch -Np1 -i ../valgrind-3.17.0-upstream_fixes-1.patch
Install Valgrind by running the
following commands:
autoreconf -fiv &&
sed -i 's|/doc/valgrind||' docs/Makefile.in &&
./configure --prefix=/usr \
--datadir=/usr/share/doc/valgrind-3.17.0 &&
make
To test the results, issue: make
regtest. The tests may hang forever if GDB-10.2 is not
installed. Some tests are known to hang also, depending on the
version of glibc. Some tests in the "drd" test suite are known to
fail as well. Problematic tests can be disabled by changing the
prereq:
line in the
corresponding .vgtest
file to
prereq: false
. For
example:
sed -e 's@prereq:.*@prereq: false@' \
-i {helgrind,drd}/tests/pth_cond_destroy_busy.vgtest
Note
The OpenMP tests are skipped if
libgomp has been compiled with --enable-linux-futex
(the default). If needed,
just recompile the libgomp library from the gcc build tree,
passing --disable-linux-futex
to
configure, storing the library to some place and changing the
link from /usr/lib/libgomp.so.1
to
point to the new library.
Now, as the root
user:
make install
Command Explanations
sed -i ...
docs/Makefile.in : This sed provides for installing
the documentation in a versioned directory.
--enable-lto=yes
: This option allows
building Valgrind with LTO (link time optimization). This produces
a smaller/faster Valgrind (up to 10%), but build time increases to
about 5.5 SBU.