#### Beyond Linux® From Scratch (System V Edition) - Version 12.3

### Chapter 13. Programming

- Prev

  Vala-0.56.17

- Next

  yasm-1.3.0

- Up
- Home

# Valgrind-3.24.0

## 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 12.3 platform.

### Package Information

- Download (HTTP): https://sourceware.org/pub/valgrind/valgrind-3.24.0.tar.bz2

- Download MD5 sum: 7ae7ffc6b3cff48fe35076266c128226

- Download size: 16 MB

- Estimated disk space required: 396 MB (add 85 MB for tests)

- Estimated build time: 0.4 SBU (add 6.5 SBU for tests; both using parallelism=4)

### Valgrind Dependencies

#### Optional

docbook-xml-4.5 (for tests), GDB-16.2 (for tests), LLVM-19.1.7 (with Clang), and Which-2.23 (for tests)

## Installation of Valgrind

Install Valgrind by running the following commands:

    sed -i 's|/doc/valgrind||' docs/Makefile.in &&

    ./configure --prefix=/usr \
                --datadir=/usr/share/doc/valgrind-3.24.0 &&
    make

To test the results, issue: make regtest. The tests may hang forever if GDB-16.2 is not installed. Some tests are known to hang also, depending on the version of glibc. A few tests can fail in various suites. 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.

## Contents

Installed Programs: callgrind_annotate, callgrind_control, cg_annotate, cg_diff, cg_merge, ms_print, valgrind, valgrind-di-server, valgrind-listener, and vgdb
Installed Libraries: None
Installed Directories: /usr/lib/valgrind, /usr/libexec/valgrind, /usr/include/valgrind, and /usr/share/doc/valgrind-3.24.0

### Short Descriptions

valgrind | is a program for debugging and profiling Linux executables
callgrind_annotate | takes an output file produced by the Valgrind tool Callgrind and prints the information in an easy-to-read form
callgrind_control | controls programs being run by the Valgrind tool Callgrind
cg_annotate | is a post-processing tool for the Valgrind tool Cachegrind
cg_diff | compares two Cachegrind output files
cg_merge | merges multiple Cachegrind output files into one
ms_print | takes an output file produced by the Valgrind tool Massif and prints the information in an easy-to-read form
valgrind-di-server | is a server that reads debuginfo from objects stored on a different machine
valgrind-listener | listens on a socket for Valgrind commentary
vgdb | is an intermediary between Valgrind and GDB or a shell

- Prev

  Vala-0.56.17

- Next

  yasm-1.3.0

- Up
- Home