Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 114347 - valgrind 3.1.0 build undefined references
Summary: valgrind 3.1.0 build undefined references
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Maurice van der Pot (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-03 05:46 UTC by Graham Murray
Modified: 2006-01-26 10:51 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Graham Murray 2005-12-03 05:46:47 UTC
Building valgrind-3.1.0 failed with undefined references to
__stack_smash_handler and __guard. These (versioned) symbols are defined in
/lib/tls/libc.so.6

Reproducible: Always
Steps to Reproduce:
1. emerge valgrind


Actual Results:  
i686-pc-linux-gnu-gcc  -m32 -mpreferred-stack-boundary=2 -O -g
-Wmissing-prototypes -Winline -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes
-Wmissing-d
eclarations -O2 -march=nocona -mtune=nocona -pipe -fstack-protector -fno-pie
-Wno-long-long -Wdeclaration-after-statement   -o memcheck-x86-linux -static -
Wl,-defsym,valt_load_address=0xb0000000 -nodefaultlibs -nostartfiles -u _start
-m32 -Wl,-T,../valt_load_address_x86_linux.lds memcheck_x86_linux-mac_leakch
eck.o memcheck_x86_linux-mac_malloc_wrappers.o memcheck_x86_linux-mc_main.o
memcheck_x86_linux-mac_shared.o memcheck_x86_linux-mc_translate.o ../coregrind/
libcoregrind_x86_linux.a ../VEX/libvex_x86_linux.a -lgcc
memcheck_x86_linux-mac_leakcheck.o: In function `scan_all_valid_memory_catcher':
/var/tmp/portage/valgrind-3.1.0/work/valgrind-3.1.0/memcheck/mac_leakcheck.c:68:
undefined reference to `__guard'
/var/tmp/portage/valgrind-3.1.0/work/valgrind-3.1.0/memcheck/mac_leakcheck.c:73:
undefined reference to `__stack_smash_handler'
memcheck_x86_linux-mac_leakcheck.o: In function `str_lossmode':
/var/tmp/portage/valgrind-3.1.0/work/valgrind-3.1.0/memcheck/mac_leakcheck.c:241:
undefined reference to `__guard'
/var/tmp/portage/valgrind-3.1.0/work/valgrind-3.1.0/memcheck/mac_leakcheck.c:250:
undefined reference to `__stack_smash_handler'

This continued for several hundred more lines

Expected Results:  
The build should have completed

emerge --info
Portage 2.0.53 (default-linux/x86/2005.1, gcc-3.4.4, glibc-2.3.6-r0,
2.6.14-gentoo-r4 i686)
=================================================================
System uname: 2.6.14-gentoo-r4 i686 Intel(R) Pentium(R) 4 CPU 3.20GHz
Gentoo Base System version 1.12.0_pre11
dev-lang/python:     2.3.5, 2.4.2
sys-apps/sandbox:    1.2.16
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1-r1
sys-devel/libtool:   1.5.20-r1
virtual/os-headers:  2.6.11-r3
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=nocona -mtune=nocona -pipe -fstack-protector
-fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env
/usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3.5/env
/usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /var/bind
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/texmf/web2c /etc/env.d"
CXXFLAGS="-O2 -march=nocona -mtune=nocona -pipe -fstack-protector
-fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://gentoo.inode.at/ http://ftp.romnet.org/gentoo/
http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/
http://pandemonium.tiscali.de/pub/gentoo/ http://gentoo.inf.elte.hu/"
LANG="en_GB.UTF-8"
LC_ALL="en_GB.UTF-8"
LINGUAS="en_GB"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="x86 X a52 aac aalib acl acpi aim alsa apache2 apm arts audiofile avi
bash-completion berkdb bitmap-fonts bonobo browserplugin bzip2 bzlib caps
cdparanoia cdr cjk crypt cups curl dbus doc dts dvd dvdr eds emacs emboss encode
esd ethereal examples exif expat fam fbcon ffmpeg flac foomaticdb fortran gcj gd
gdbm gif glut gmp gnome gnutls gphoto2 gpm gstreamer gtk gtk2 gtkhtml guile hal
iconv icq idn ieee1394 imagemagick imlib ipv6 jabber jack java javascript jce
jpeg junit kde lcms leim libg++ libgda libwww lm_sensors logrotate lua mad mbox
mikmod milter mime mmap mmx mng motif mozilla mp3 mpeg mpi msn ncurses nls nptl
nsplugin offensive ogg oggvorbis opengl oscar oss pam pcntl pcre pdflib perl png
postgres profile python qt quicktime readline recode sdl sharedmem slang sndfile
snmp sockets sox speex spell sqlite sse ssl svg sysvipc tcltk tcpd tetex theora
threads tiff truetype truetype-fonts type1-fonts udev unicode usb v4l vhosts
vorbis win32codecs wmf xface xine xml xml2 xmms xv xvid yahoo zlib linguas_en_GB
userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LDFLAGS
Comment 1 Maurice van der Pot (RETIRED) gentoo-dev 2005-12-03 09:18:54 UTC
The problem is that your compiler was built with a hardened gcc. Because
valgrind doesn't link with glibc, it is missing some symbols referenced from libgcc.

Apart from compiling valgrind with a compiler that was built with a gcc without
ssp, I don't know any solutions yet, but I'll look into it.
Comment 2 Howard B. Golden 2005-12-03 12:00:10 UTC
Re Comment #1: FWIW, something must have changed in this version of valgrind
about the relationship with a hardened GCC, since AFAIK I've been building
previous versions that way without getting the missing symbols.
Comment 3 Maurice van der Pot (RETIRED) gentoo-dev 2005-12-03 14:24:40 UTC
You're right, something did change.

Also, the problem you are seeing is not just because of what I said in comment #1.

Most of the error messages are actually caused by building valgrind with ssp.
I'll add a filter for -fstack-protector to the ebuild. To see what difference
that will make, you can build valgrind without -fstack-protector in your CFLAGS.

What remains will hopefully be fixed by some changes we're currently discussing.
Comment 4 Maurice van der Pot (RETIRED) gentoo-dev 2005-12-05 10:39:33 UTC
I've modified the ebuild to make sure valgrind is not built with SSP.
This should get rid of most of the messages you got.

If you still have a few left in libgcc, then it is actually bug #114552
you are seeing. If you see them in valgrind itself, then please reopen this bug.

Hope this helps. Thanks for the report.
Comment 5 Andrej Kacian (RETIRED) gentoo-dev 2005-12-13 01:50:30 UTC
I get similar error, even with updated ebuild (I'm not using -fstack-protector):

i686-pc-linux-gnu-gcc  -m32 -mpreferred-stack-boundary=2 -fno-stack-protector -O
-g -Wmissing-prototypes -Winline -Wall -Wshadow -Wpointer-arith
-Wstrict-prototypes -Wmissing-declarations -march=pentium4 -O2 -pipe -ggdb
-fno-pie -fno-stack-protector -Wno-long-long -Wdeclaration-after-statement   -o
memcheck-x86-linux -static -Wl,-defsym,valt_load_address=0xb0000000
-nodefaultlibs -nostartfiles -u _start -m32
-Wl,-T,../valt_load_address_x86_linux.lds memcheck_x86_linux-mac_leakcheck.o
memcheck_x86_linux-mac_malloc_wrappers.o memcheck_x86_linux-mc_main.o
memcheck_x86_linux-mac_shared.o memcheck_x86_linux-mc_translate.o
../coregrind/libcoregrind_x86_linux.a ../VEX/libvex_x86_linux.a -lgcc
/usr/lib/gcc/i686-pc-linux-gnu/3.4.4/libgcc.a(_udivdi3.oS): In function `__udivdi3':
/var/tmp/portage/gcc-3.4.4-r1/work/gcc-3.4.4/gcc/libgcc2.c:1127: undefined
reference to `__guard'
/var/tmp/portage/gcc-3.4.4-r1/work/gcc-3.4.4/gcc/libgcc2.c:1129: undefined
reference to `__stack_smash_handler'
/usr/lib/gcc/i686-pc-linux-gnu/3.4.4/libgcc.a(_umoddi3.oS): In function `__umoddi3':
/var/tmp/portage/gcc-3.4.4-r1/work/gcc-3.4.4/gcc/libgcc2.c:1115: undefined
reference to `__guard'
/var/tmp/portage/gcc-3.4.4-r1/work/gcc-3.4.4/gcc/libgcc2.c:1121: undefined
reference to `__stack_smash_handler'
collect2: ld returned 1 exit status
make[3]: *** [memcheck-x86-linux] Error 1
make[3]: Leaving directory
`/var/tmp/portage/valgrind-3.1.0/work/valgrind-3.1.0/memcheck'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory
`/var/tmp/portage/valgrind-3.1.0/work/valgrind-3.1.0/memcheck'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/valgrind-3.1.0/work/valgrind-3.1.0'
make: *** [all] Error 2

# emerge --info
Portage 2.0.53 (hardened/x86/2.6, gcc-3.4.4, glibc-2.3.5-r3, 2.6.13-hardened-r2
i686)
=================================================================
System uname: 2.6.13-hardened-r2 i686 Intel(R) Celeron(R) CPU 2.60GHz
Gentoo Base System version 1.12.0_pre11
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.4 [enabled]
dev-lang/python:     2.3.5, 2.4.2
sys-apps/sandbox:    1.2.11
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1-r1
sys-devel/libtool:   1.5.20-r1
virtual/os-headers:  2.6.11-r3
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=pentium4 -O2 -pipe -ggdb"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.5/env
/usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=pentium4 -O2 -pipe -ggdb"
DISTDIR="/usr/gentoo/distfiles"
FEATURES="autoconfig ccache collision-protect cvs digest distlocks nostrip
sandbox sfperms sign strict"
GENTOO_MIRRORS="http://mirror.gentoo.sk/pub
ftp://ftp.sh.cvut.cz/MIRRORS/gentoo/gentoo http://ftp.easynet.nl/mirror/gentoo"
LC_ALL="sk_SK.UTF-8"
MAKEOPTS="-j2"
PKGDIR="/usr/gentoo/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/gentoo/portage"
PORTDIR_OVERLAY="/usr/gentoo/overlay"
SYNC="rsync://gentoo.ynet.sk/gentoo-portage"
USE="X alsa audiofile bash-completion berkdb bitmap-fonts bluetooth bzip2 cairo
cdr crypt curl divx4linux dlloader dvd dvdr dvdread ethereal exif expat faad fam
ffmpeg gdbm gif glut gpm gtk gtk2 hardened icecast idn imagemagick imlib java
jpeg lcms ldap mad mbox mmx mng moznocompose moznoirc moznomail moznoxft mp3
ncurses nls nntp nptl nptlonly nvidia ogg oggvorbis opengl openssl oss pam pcre
perl pic png python readline real recode rtc samba sample sdl slang sse sse2 ssl
tcpd tiff truetype type1 udev unicode usb userlocales vim-with-x vorbis x86 xml2
xv xvid zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LDFLAGS, LINGUAS

Reopening.
Comment 6 Maurice van der Pot (RETIRED) gentoo-dev 2005-12-13 03:41:53 UTC
That would be bug #114552, which has already been fixed.
To get rid of your problem, you need to rebuild gcc and then rebuild valgrind.
Comment 7 Maurice van der Pot (RETIRED) gentoo-dev 2006-01-26 10:51:24 UTC
Ticho confirmed his problem went away. =)