I got this problem when linking: i686-pc-linux-gnu-g++ -I/usr/include/SDL -D_REENTRANT -Dsgmain -DNEWKEYB -DNO_PARAGUI -I/usr/lib/sigc++-1.2/include -I/usr/include/sigc++-1.2 -march=athlon -O3 -pipe -Wno-sign-compare -funsigned-char -D_UNIX_ -D_SDL_ -o asc unitctrl.o soundList.o typen.o strtmesg.o stack.o spfst.o sgstream.o sg.o pd.o palette.o newfont.o network.o misc.o loadpcxc.o loaders.o loadbi3.o gui.o gamedlg.o dlg_box.o dialog.o controls.o building.o basestrm.o basegfx.o attack.o CLoadable.o Property.o PropertyGroup.o gameoptions.o Named.o astar2.o vehicletype.o buildingtype.o containerbase.o mapalgorithms.o viewcalculation.o gamemap.o password.o password_dialog.o replay.o research.o mapdisplay.o resourcenet.o dashboard.o ascstring.o graphicset.o vehicle.o buildings.o networkdata.o textfileparser.o terraintype.o objecttype.o textfiletags.o itemrepository.o stringtokenizer.o music.o messages.o paradialog.o textfile_evaluation.o containerbasetype.o messagedlg.o simplestream.o mappolygons.o prehistoricevents.o gameevents.o gameeventsystem.o gameevent_dialogs.o statisticdialog.o clipboard.o ../../../source/libs/triangul/.libs/libtriangul.a ../../../source/ai/.libs/libai.a ../../../source/libs/sdlmm/src/.libs/libSDLmm.a ../../../source/sdl/.libs/libsdl.a /usr/lib/libSDL_image.so -lpng /usr/lib/libtiff.so -lz -lc /usr/lib/libSDL_mixer.so -L/usr/lib /usr/lib/libvorbisfile.so /usr/lib/libvorbis.so /usr/lib/libogg.so /usr/lib/libsmpeg.so -lstdc++ /usr/lib/libmikmod.so /usr/lib/libjpeg.so -lbz2 /usr/lib/libsigc-1.2.so /usr/lib/libSDL.so -lm /usr/lib/libXext.so /usr/lib/libX11.so /usr/lib/libXau.so /usr/lib/libXdmcp.so -ldl -lpthread building.o: In function `ccontainer_t::chosticons_ct::init(int, int)': building.cpp:(.text+0x15c6): undefined reference to `GuiHost<generalicon_c*>::chainiconstohost(generalicon_c*)'building.o: In function `ccontainer_b::chosticons_cb::init(int, int)': building.cpp:(.text+0x1616): undefined reference to `GuiHost<generalicon_c*>::chainiconstohost(generalicon_c*)'building.o: In function `ccontainer_b::init(Building*)': building.cpp:(.text+0x150dc): undefined reference to `GuiHost<generalicon_c*>::chainiconstohost(generalicon_c*)' building.o: In function `ccontainer_t::init(Vehicle*)': building.cpp:(.text+0x15418): undefined reference to `GuiHost<generalicon_c*>::chainiconstohost(generalicon_c*)' collect2: ld returned 1 exit status make[1]: *** [asc] Error 1 make[1]: Leaving directory `/var/tmp/portage/asc-1.16.3.0/work/asc-1.16.3.0/source/unix/asc'
Works for me with gcc-4.1.1. What is your `emerge --info` and did you try recompiling everything it depends on with gcc-4.1?
my emerge --info ( I will try to emerge gcc-4.1.1 and test it again) Portage 2.1_rc2-r1 (default-linux/x86/2006.0, gcc-4.1.0, glibc-2.4-r3, 2.6.16-gentoo-r7 i686) ================================================================= System uname: 2.6.16-gentoo-r7 i686 AMD Duron(tm) processor Gentoo Base System version 1.6.14 distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled] ccache version 2.3 [enabled] dev-lang/python: 2.3.5-r2, 2.4.2 dev-python/pycrypto: 2.0.1-r5 dev-util/ccache: 2.3 dev-util/confcache: [Not Present] sys-apps/sandbox: 1.2.17 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 sys-devel/libtool: 1.5.22 virtual/os-headers: 2.6.11-r2 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-march=athlon -O3 -pipe" 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/share/config /usr/share/X11/xkb /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/eselect/compiler /etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-march=athlon -O3 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs autoconfig ccache cvs digest distcc distlocks metadata-transfer nostrip sandbox sfperms sign strict" GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo" LANG="it_IT.UTF-8" LC_ALL="it_IT.UTF-8" MAKEOPTS="-j3" PKGDIR="/usr/portage/packages" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="x86 3dnow X X509 Xaw3d acpi adns alsa apache2 apm ares arts artworkextra asf avi bash-completion berkdb bitmap-fonts bzip2 cairo canvas cdr cli crypt cups curl dbus dv dvd dxr3 eds emacs emboss encode erandom ffmpeg firefox flac foomaticdb fortran gdbm gif gimpprint gnome gnutls gpm gs gstreamer gtk gtk2 gtkhtml guile hal howl idn imagemagick imap imlib isdnlog jack java jbig jpeg kerberos lcms ldap libg++ libwww mad mikmod mmx mng moznoirc moznomail mozsvg mp3 mpeg multitarget mysql ncurses network nls nntp nptl nptlonly nsplugin nvidia odbc offensive ogg openal opengl oss pam pcre pdflib perl png pppd python qt quicktime readline real reflection sdl session sftplogging silc skey slp sndfile snmp softmmu speex spell spl sqlite sse ssl svg tcltk tcpd tetex theora threads tiff toolbar truetype truetype-fonts type1-fonts udev unicode usb v4l vidix vim-with-x vorbis win32codecs wmf xatrix xchatdccserver xine xml xml2 xmms xorg xv xvid xvmc yv12 zlib elibc_glibc input_devices_keyboard input_devices_mouse kernel_linux userland_GNU video_cards_nvidia" Unset: ASFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, LINGUAS, PORTAGE_RSYNC_EXTRA_OPTS
build with gcc-4.1.1
:( compiler switched to gcc-3.4. So my last report was wrong. Error is still the same, even with gcc-4.1.1
-O3 seems to inline GuiHost<generalicon_c*>::chainiconstohost(generalicon_c*) in gui.o but that is also used outside, in building.cpp, so linker is not finding that. Maybe a gcc bug. Should we filter the -O3 then or wait for a fix to the compiler?
-O3 with gcc-4 replaced with -O2 in portage
(In reply to comment #6) > -O3 with gcc-4 replaced with -O2 in portage You said you had the same error with gcc-3.4?
(In reply to comment #7) > (In reply to comment #6) > > -O3 with gcc-4 replaced with -O2 in portage > > You said you had the same error with gcc-3.4? > No, I don't. Problem I saw is with gcc-4.1 and gcc-4.1.1. No problem with gcc-3.4.
So is this one fixed? I'm a bit confused.
(In reply to comment #9) > So is this one fixed? I'm a bit confused. > Bug is in the compiler, and my guess is that is still there. Workaround for asc is to change -O3 with -O2 when using gcc-4. This change is already in the ebuild. So, yes, for what regards games team, it is fixed.
Let's mark it as such, then.
The reason why I left it open is as a remind for a bug for gcc that need to be fixed. I assigned this to Gentoo Toolchain Maintainers <toolchain@gentoo.org> for exactly this reason. However I don't insist on let it open, as it seems nobody care of that bug :)