>From time to time Valgrind users ask how the Valgrind source code can
be cross-compiled. While cross-compiling Valgrind is no different of
cross-compiling any other project that is based on autotools, I'm
posting here a script that should help those who are not familiar with
cross-compilation. What the script does is to check out the Valgrind
source tree from the Subversion repository in a subdirectory of the
current working directory, set up a directory $PWD/bin with soft links
to the cross-compilation tools, add this directory to the path, and
invoke autogen.sh, configure and make. Setting up a directory with
soft links to the cross compilation tools is more convenient than
having to pass the variables CC, AS, LD etc. individually to
configure.

#!/bin/bash

# Make sure to adjust the four variables below such that these match your setup.
CROSS_TOOLS_PREFIX=/opt/cell/bin/ppu-
PREFIX=$HOME/valgrind-inst
TARGET=powerpc64-unknown-linux
HOST=x86_64-linux-gnu
valgrind_dir="valgrind-trunk"

svn co svn://svn.valgrind.org/valgrind/trunk "${valgrind_dir}" || exit $?
cd "${valgrind_dir}" || exit $?

rm -rf bin
mkdir -p bin
(
  cd bin
  for f in ${CROSS_TOOLS_PREFIX}*
  do
    ln -s $f $TARGET-${f#${CROSS_TOOLS_PREFIX}}
  done
)
export PATH="${PATH}:$PWD/bin"

./autogen.sh  || exit $?
./configure            \
    --build=$HOST      \
    --host=$TARGET     \
    --prefix=$PREFIX   \
    --target=$TARGET   \
    --enable-tls       \
 || exit $?

make -s       || exit $?
make -s check || exit $?

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to