This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
How to compile glibc debuginfo: valgrind complaining
- From: cswanson at ns1 dot sysdel dot com
- To: libc-help at sourceware dot org
- Date: Tue, 2 Mar 2010 23:23:20 -0800 (PST)
- Subject: How to compile glibc debuginfo: valgrind complaining
Hi,
Stats: Fedora 12 base minimal install, compiled glibc 2.10.1, gcc-4.4.2,
binutils-2.19.
Followed Linux from Scratch directions (more or less). Did not replace system
libraries.
Valgrind compiled with new tool chain.
This question is actually a prelude to a wider issue that may come in
another cry for
help. :)
Valgrind 3.5.0 is reporting the following message:
valgrind: Fatal error at startup: a function redirection
valgrind: which is mandatory for this platform-tool combination
valgrind: cannot be set up. Details of the redirection are:
valgrind:
valgrind: A must-be-redirected function
valgrind: whose name matches the pattern: strlen
valgrind: in an object with soname matching: ld-linux-x86-64.so.2
valgrind: was not found whilst processing
valgrind: symbols from the object with soname: ld-linux-x86-64.so.2
valgrind:
valgrind: Possible fixes: (1, short term): install glibc's debuginfo
valgrind: package on this machine. (2, longer term): ask the packagers
valgrind: for your Linux distribution to please in future ship a non-
valgrind: stripped ld.so (or whatever the dynamic linker .so is called)
valgrind: that exports the above-named function using the standard
valgrind: calling conventions for this platform.
valgrind:
valgrind: Cannot continue -- exiting now. Sorry.
The command 'file' output:
$file /usr/local/tools-0.0.2/lib/libc-2.10.1.so
/usr/local/tools-0.0.2/lib/libc-2.10.1.so: ELF 64-bit LSB shared object,
x86-64, version 1
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.33, not
stripped
This output seems to say the dynamic linker is not stripped, so I must be
missing something.
I am impressed I may have not configured part of the tool chain build
correctly.
Thanks,
Chris Swanson
I tried to give HTML pages to the build scripts but the MAILER kicked it back.
I'll post them here:
binutils-pass1
#!/bin/sh
INSTALLDIR=tools-0.0.2
BINUTILS=binutils-2.19
CWD=`pwd`
TARGET=x86_64-isl-linux-gnu
if [ -d $BINUTILS ]; then
rm -rf $BINUTILS
fi
if [ -d $CWD/build ]; then
rm -rf $CWD/build
fi
mkdir build
if [ -d /usr/local/$INSTALLDIR ]; then
echo "Removing /usr/local/$INSTALLDIR"
su root -c "rm -rf /usr/local/$INSTALLDIR; mkdir /usr/local/$INSTALLDIR; cd
/usr/src/linux-2.
6.33; make O=/root/linux-2.6.33-1 headers_check;make
INSTALL_HDR_PATH=/usr/local/$INSTALLDIR head
ers_install; chown -R cswanson /usr/local/$INSTALLDIR"
else
su root -c "mkdir /usr/local/$INSTALLDIR; cd /usr/src/linux-2.6.33; make
O=/root/linux-2.6.33
-1 headers_check;make INSTALL_HDR_PATH=/usr/local/$INSTALLDIR headers_install;
chown -R cswanson
/usr/local/$INSTALLDIR"
fi
tar xvfj ~/source/$BINUTILS.tar.bz2
cd $CWD/build
../$BINUTILS/configure --build=x86_64-redhat-linux --target=$TARGET
--host=x86_64-redhat-linux --
prefix=/usr/local/$INSTALLDIR --disable-nls --disable-werror
make
make install
cd $CWD
###############################################################
gcc-pass1:
#!/bin/sh
INSTALLDIR=tools-0.0.2
GCCBUILD=gcc-4.4.2
MPFR=mpfr-2.4.2
GMP=gmp-5.0.1
CWD=`pwd`
TARGET=x86_64-isl-linux-gnu
CFLAGS="-static -Wl,--verbose"
PATH=/usr/local/$INSTALLDIR/bin:$PATH
export PATH CFLAGS
if [ -d $GCCBUILD ]; then
/bin/rm -rf $GCCBUILD
fi
if [ -d $MPFR ]; then
/bin/rm -rf $MPFR
fi
if [ -d $GMP ]; then
/bin/rm -rf $GMP
fi
if [ -d build ]; then
/bin/rm -rf build
fi
/bin/tar xvfj ~/source/$GCCBUILD.tar.bz2
/bin/tar xvfj ~/source/mpfr-2.4.2.tar.bz2
/bin/tar xvfj ~/source/gmp-5.0.1.tar.bz2
cd $GMP
./configure --prefix=/usr/local/$INSTALLDIR
make
make install
cd $CWD
cd $MPFR
./configure --prefix=/usr/local/$INSTALLDIR --with-gmp=/usr/local/$INSTALLDIR
make
make install
cd $CWD
/bin/mkdir build
cd build
../$GCCBUILD/configure --build=x86_64-redhat-linux --target=$TARGET
--host=x86_64-redhat-linux --
prefix=/usr/local/$INSTALLDIR -disable-nls --disable-shared --disable-multilib
--disable-decimal-
float --disable-threads --disable-libmudflap --disable-libssp --disable-libgomp
--enable-language
s=c --with-gmp=/usr/local/$INSTALLDIR -with-mpfr=/usr/local/$INSTALLDIR
make
make install
ln -s /usr/local/$INSTALLDIR/lib/gcc/x86_64-isl-linux-gnu/4.4.2/libgcc.a
/usr/local/$INSTALLDIR/l
ib/gcc/x86_64-isl-linux-gnu/4.4.2/libgcc_eh.a
cd $CWD
#####################################################################
glibc-pass1
#!/bin/sh
CWD=`pwd`
INSTALLDIR=tools-0.0.2
GLIBC=glibc-2.10.1
HEADERS=/usr/local/$INSTALLDIR/include
TARGET=x86_64-isl-linux-gnu
AS=/usr/local/$INSTALLDIR/bin/x86_64-isl-linux-gnu-as
CC=/usr/local/$INSTALLDIR/bin/x86_64-isl-linux-gnu-gcc
LDFLAGS="-B/usr/lib -B/usr/lib64 -L/usr/lib -L/lib -L/lib64 -L/usr/lib64"
CFLAGS="-Wl,--rpath-link /lib64 -Wl,--verbose -O"
PATH=/usr/local/$INSTALLDIR/bin:$PATH
export PATH CC AS LDFLAGS CFLAGS
if [ -d $GLIBC ]; then
rm -rf $GLIBC
fi
if [ -d build ]; then
rm -rf build
fi
tar xvfj ~/source/$GLIBC.tar.bz2
cd $CWD
mkdir $CWD/build
cd $CWD/build
../$GLIBC/configure --build=$TARGET --target=$TARGET --host=$TARGET
--prefix=/usr/local/$INSTALLD
IR --disable-profile --enable-kernel=2.6.33 --with-headers=$HEADERS
libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes
make
mkdir /usr/local/$INSTALLDIR/etc
touch /usr/local/$INSTALLDIR/etc/ld.so.conf
make install
cd $CWD
#########################################################################
binutils-pass2
#!/bin/sh
CWD=`pwd`
INSTALLDIR=tools-0.0.2
BINUTILS=binutils-2.19
TARGET=x86_64-isl-linux-gnu
AS=/usr/local/$INSTALLDIR/bin/x86_64-isl-linux-gnu-as
CC=/usr/local/$INSTALLDIR/bin/x86_64-isl-linux-gnu-gcc
AR=/usr/local/$INSTALLDIR/bin/x86_64-isl-linux-gnu-ar
RANLIB=/usr/local/$INSTALLDIR/bin/x86_64-isl-linux-gnu-ranlib
PATH=/usr/local/$INSTALLDIR/bin:$PATH
CFLAGS="-Wl,--verbose -Wl,-rpath-link /usr/local/$INSTALLDIR/lib
-B/usr/local/$INSTALLDIR/lib"
export PATH CC AS AR RANLIB CFLAGS
if [ -d $BINUTILS ]; then
rm -rf $BINUTILS
fi
if [ -d $CWD/build ]; then
rm -rf $CWD/build
fi
mkdir build
tar xvfj ~/source/$BINUTILS.tar.bz2
cd $CWD/build
../$BINUTILS/configure --prefix=/usr/local/$INSTALLDIR --build=$TARGET
--target=$TARGET --host=$TARGET --disable-nls
--with-lib-path=/usr/local/$INSTALLDIR/lib
make
make install
cd $CWD
#########################################################################
gcc-pass2
#!/bin/sh
INSTALLDIR=tools-0.0.2
GCCBUILD=gcc-4.4.3
MPFR=mpfr-2.4.2
GMP=gmp-5.0.1
CWD=`pwd`
TARGET=x86_64-isl-linux-gnu
CFLAGS="-fPIC -Wl,--verbose -B/usr/local/$INSTALLDIR/lib
-L/usr/local/$INSTALLDIR/lib"
AS=/usr/local/$INSTALLDIR/bin/x86_64-isl-linux-gnu-as
CC=/usr/local/$INSTALLDIR/bin/x86_64-isl-linux-gnu-gcc
AR=/usr/local/$INSTALLDIR/bin/x86_64-isl-linux-gnu-ar
RANLIB=/usr/local/$INSTALLDIR/bin/x86_64-isl-linux-gnu-ranlib
PATH=/usr/local/$INSTALLDIR/bin:$PATH
export PATH CFLAGS AS CC AR RANLIB LDFLAGS
if [ -d $GCCBUILD ]; then
/bin/rm -rf $GCCBUILD
fi
if [ -d build ]; then
/bin/rm -rf build
fi
/bin/tar xvfj ~/source/$GCCBUILD.tar.bz2
/bin/mkdir build
cd $CWD/$GCCBUILD
#############################################################
# Change dynamic linker to be the one recently compiled. #
#############################################################
for file in \
$(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
do
cp -uv $file{,.orig}
sed -e 's@/lib\(64\)\?\(32\)\?/ld@/usr/local/'$INSTALLDIR'&@g' \
-e 's@/usr@/usr@g' $file.orig > $file
echo '
#undef STANDARD_INCLUDE_DIR
#define STANDARD_INCLUDE_DIR 0
#define STANDARD_STARTFILE_PREFIX_1 ""
#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
touch $file.orig
done
#############################################################
# unsetting the multilib spec for GCC ensures that it won't #
# attempt to link against libraries on the host. #
#############################################################
case $(uname -m) in
x86_64)
for file in $(find gcc/config -name t-linux64) ; do \
cp -v $file{,.orig}
sed '/MULTILIB_OSDIRNAMES/d' $file.orig > $file
done
;;
esac
cd $CWD/build
../$GCCBUILD/configure --prefix=/usr/local/$INSTALLDIR --build=$TARGET
--target=$TARGET --host=$T
ARGET --with-local-prefix=/usr/local/$INSTALLDIR --enable-clocale=gnu
--enable-shared --enable-th
reads=posix --enable-__cxa_atexit --enable-languages=c,c++
--disable-libstdcxx-pch --disable-mult
ilib --disable-bootstrap --with-gmp=/usr/local/$INSTALLDIR
-with-mpfr=/usr/local/$INSTALLDIR
############################################################################
# Must copy crti.o and crtn.o to build/x86_64-unknown-linux-gnu/libmudflap #
# Must create the directories #
############################################################################
mkdir $CWD/build/x86_64-isl-linux-gnu
mkdir $CWD/build/x86_64-isl-linux-gnu/libmudflap
mkdir $CWD/build/x86_64-isl-linux-gnu/libssp
mkdir $CWD/build/x86_64-isl-linux-gnu/libgomp
cp /usr/local/$INSTALLDIR/lib/crti.o /usr/local/$INSTALLDIR/lib/crtn.o
$CWD/build/x86_64-isl-linu
x-gnu/libmudflap
cp /usr/local/$INSTALLDIR/lib/crti.o /usr/local/$INSTALLDIR/lib/crtn.o
$CWD/build/x86_64-isl-linu
x-gnu/libssp
cp /usr/local/$INSTALLDIR/lib/crti.o /usr/local/$INSTALLDIR/lib/crtn.o
$CWD/build/x86_64-isl-linu
x-gnu/libgomp
make
make install
cd $CWD
################################################################
This script is run after glibc compilation:
#!/bin/sh
INSTALLDIR=tools-0.0.2
PATH=/usr/local/$INSTALLDIR/bin:$PATH
export PATH
SPECS=`dirname $(x86_64-isl-linux-gnu-gcc -print-libgcc-file-name)`/specs
x86_64-isl-linux-gnu-gcc -dumpspecs | sed \
-e 's@/lib\(64\)\?/ld@/usr/local/'$INSTALLDIR'&@g' \
-e "/^\*cpp:$/{n;s,$, -isystem /usr/local/"$INSTALLDIR"/include,}" > $SPECS
echo "New specs file is: $SPECS"
unset SPECS