Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 51838

Summary: dar-2.1.2-r1 does not build with gcc 3.4.0-r4 using -O2
Product: Gentoo Linux Reporter: Holger Hoffstätte <holger>
Component: Current packagesAssignee: Please assign to toolchain <gcc-porting>
Status: RESOLVED FIXED    
Severity: normal CC: andreas.w.simon
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 48528    

Description Holger Hoffstätte 2004-05-23 09:14:54 UTC
I tried to emerge dar-2.1.2-r1 using gcc-3.4.0-r4 and got strange linker errors about undefined symbols, although the supposedly missing functions definitely exist (in dar itself). Since I could compile dar-2.1.3 manually using only -O, I modified the ebuild and presto! everything worked (I guess the same holds true for 2.1.2). The ebuild already contains a pessimization for -O(>=3); it seems gcc 3.4.0 'optimizes' away something that is required for linking (just my humble guess). In any case emerging with only -O finishes correctly, and the resulting executables seem to work fine.


Reproducible: Always
Steps to Reproduce:
1. switch to gcc-3.4.0-r4
2. emerge dar using -O2 CFLAGS/CXXFLAGS
3. watch the linker fail to produce libdar

Actual Results:  
The ebuild stops with a linker error.


Expected Results:  
The ebuild should have finished (linking).


The problem is definitely not a broken dependency, bad gcc setup or anything
else. I reproduced it on two different (but identically configured) machine.
Might be a gcc bug or just funny C++ in dar.
Comment 1 Andreas Simon 2004-06-27 07:21:35 UTC
Here is the error message I get:

...
/bin/sh ../../libtool --mode=link g++  -march=athlon-xp -O2 -ftracer -pipe   -o get_version  get_version.o catalogue.o compressor.o deci.o defile.o ea.o ea_filesystem.o erreurs.o etage.o filesystem.o filtre.o generic_file.o header.o header_version.o libdar.o macro_tools.o mask.o path.o sar.o sar_tools.o scrambler.o storage.o terminateur.o test_memory.o tools.o tronc.o tuyau.o user_interaction.o wrapperlib.o zapette.o special_alloc.o archive.o crypto.o real_infinint.o -lattr -ldl -lbz2 -lz
g++ -march=athlon-xp -O2 -ftracer -pipe -o get_version get_version.o catalogue.o compressor.o deci.o defile.o ea.o ea_filesystem.o erreurs.o etage.o filesystem.o filtre.o generic_file.o header.o header_version.o libdar.o macro_tools.o mask.o path.o sar.o sar_tools.o scrambler.o storage.o terminateur.o test_memory.o tools.o tronc.o tuyau.o user_interaction.o wrapperlib.o zapette.o special_alloc.o archive.o crypto.o real_infinint.o  /usr/lib/libattr.so -ldl -lbz2 -lz
deci.o(.gnu.linkonce.t._ZN6libdar9decicoupeINS_8infinintEEEvRPNS_7storageET_+0x72c): In function `void libdar::decicoupe<libdar::infinint>(libdar::storage*&, libdar::infinint)':
: undefined reference to `void libdar::infinint::infinint_unstack_to<unsigned char>(unsigned char&)'
filesystem.o(.text+0x26): In function `libdar::make_date(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, libdar::infinint, libdar::infinint)':
: undefined reference to `void libdar::infinint::infinint_unstack_to<long>(long&)'
filesystem.o(.text+0x45): In function `libdar::make_date(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, libdar::infinint, libdar::infinint)':
: undefined reference to `void libdar::infinint::infinint_unstack_to<long>(long&)'
generic_file.o(.text+0x38b): In function `libdar::fichier::skip(libdar::infinint const&)':
: undefined reference to `void libdar::infinint::infinint_unstack_to<long long>(long long&)'
tools.o(.text+0x4b8e): In function `libdar::tools_display_date(libdar::infinint)':
: undefined reference to `void libdar::infinint::infinint_unstack_to<long>(long&)'
tools.o(.text+0x5023): In function `libdar::tools_get_extended_size(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
: undefined reference to `libdar::infinint libdar::infinint::power<unsigned int>(unsigned int const&) const'
tools.o(.text+0x50a5): In function `libdar::tools_get_extended_size(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
: undefined reference to `libdar::infinint libdar::infinint::power<unsigned int>(unsigned int const&) const'
tools.o(.text+0x5120): In function `libdar::tools_get_extended_size(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
: undefined reference to `libdar::infinint libdar::infinint::power<unsigned int>(unsigned int const&) const'
tools.o(.text+0x5197): In function `libdar::tools_get_extended_size(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
: undefined reference to `libdar::infinint libdar::infinint::power<unsigned int>(unsigned int const&) const'
tools.o(.text+0x5210): In function `libdar::tools_get_extended_size(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
: undefined reference to `libdar::infinint libdar::infinint::power<unsigned int>(unsigned int const&) const'
tools.o(.text+0x5287): more undefined references to `libdar::infinint libdar::infinint::power<unsigned int>(unsigned int const&) const' follow
collect2: ld returned 1 exit status
make[3]: *** [get_version] Error 1
make[3]: Leaving directory `/var/tmp/portage/dar-2.1.2-r1/work/dar-2.1.2/src/libdar'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/var/tmp/portage/dar-2.1.2-r1/work/dar-2.1.2/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/dar-2.1.2-r1/work/dar-2.1.2'
make: *** [all] Error 2

!!! ERROR: app-arch/dar-2.1.2-r1 failed.
!!! Function src_compile, Line 29, Exitcode 2
!!! (no error message)



# emerge --info
Portage 2.0.50-r8 (default-x86-2004.0, gcc-3.4.0, glibc-2.3.4.20040619-r0, 2.6.7-gentoo-r6)
=================================================================
System uname: 2.6.7-gentoo-r6 i686 AMD Athlon(tm) XP 1800+
Gentoo Base System version 1.4.16
ccache version 2.3 [enabled]
Autoconf: sys-devel/autoconf-2.59-r4
Automake: sys-devel/automake-1.8.5-r1
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-march=athlon-xp -O2 -ftracer -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=athlon-xp -O2 -ftracer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache fixpackages sandbox"
GENTOO_MIRRORS="ftp://ftp.tu-clausthal.de/pub/linux/gentoo ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/opt/portage /opt/portage-kde"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
USE="3dnow X aalib acl alsa apm arts artswrappersuid avi berkdb cdr crypt cups dga divx4linux dvb dvd encode faad flac foomaticdb gdbm gif gnome gpm gstreamer gtk gtk2 imap imlib ipv6 java jpeg kde lcms ldap libg++ libwww mad maildir mikmod mmx mng motif mozilla mpeg mule ncurses nls nptl offensive oggvorbis opengl oss pam pdflib perl pic png python qt quicktime readline sasl sdl slang spell sse ssl tcltk tcpd tetex theora threads tiff truetype unicode x86 xml2 xmms xv xvid zlib"
Comment 2 Travis Tilley (RETIRED) gentoo-dev 2004-07-15 02:21:48 UTC
fixed by adding -fno-unit-at-a-time to flags if using gcc 3.4. give it some time to reach rsync. :)