Jump to content

Linux Applications Debugging Techniques/Building the toolkit

From Wikibooks, open books for an open world

The code detailed herein is slowly melted into a toolkit and is available at the LPT site.

Prerequisites

[edit | edit source]
A C++11/C++0x compiler
[edit | edit source]

If your distribution does not have such a compiler, compile one from scratch. First compile the gcc prerequsites, available here:

  • cloog
  • ppl
  • mpc
  • mpfr
  • gmp

Then compile gcc itself:

./configure \
    --enable-languages=c,c++ \
    --prefix=/opt/lpt/gcc-4.7.0-bin \
    --with-mpfr=/opt/lpt/mpfr-2.4.2-bin \
    --with-mpc=/opt/lpt/mpc-0.8.1-bin \
    --with-gmp=/opt/lpt/gmp-4.3.2-bin \
    --with-ppl=/opt/lpt/ppl-0.11-bin \
    --with-cloog=/opt/lpt/cloog-ppl-0.15.11-bin 
LD_LIBRARY_PATH=/opt/lpt/mpfr-2.4.2-bin/lib:/opt/lpt/mpc-0.8.1-bin/lib:/opt/lpt/gmp-4.3.2-bin/lib:/opt/lpt/ppl-0.11-bin/lib:/opt/lpt/cloog-ppl-0.15.11-bin/lib   make
make install
References
[edit | edit source]


This one is a straightforward ./configure && make. No need to install.


-fPIC libbfd
[edit | edit source]

The call stack code has a dependency on libbfd. If you wish to link libbfd statically to cut short a dependency on the deployment machine - which may or may not have a dynamic libbfd - you need an libbfd.a that is -fPIC compiled. This flag is needed because the static library will be linked into a shared object. The plain libbfd.a coming with the platforms might not be an -fPIC one, in which case you have to compile your own.

cd binutils-2.22/bfd
export CFLAGS = -fPIC
/configure 
make

No need to install it either.


Compilation

[edit | edit source]

Finally, we need to adjust the LPT Makefile:

CXX11_HOME       = /opt/lpt/gcc-4.7.0-bin
PAPI_HOME        = /opt/lpt/papi-4.4.0/src
LIBBFD_FPIC_HOME = /opt/lpt/binutils-2.22/bfd