Bug 232592 - games-sports/torcs-1.3.0 fails to compile with --as-needed
Bug#: 232592 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: minor Priority: P2
Resolution: FIXED Assigned To: games@gentoo.org Reported By: lavish@gmail.com
Component: Development
URL: 
Summary: games-sports/torcs-1.3.0 fails to compile with --as-needed
Keywords:  
Status Whiteboard: 
Opened: 2008-07-21 20:01 0000
Description:   Opened: 2008-07-21 20:01 0000
[...]
make[3]: Entering directory
`/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/src/linux'
i686-pc-linux-gnu-gcc -E  -M -D__DEPEND__
-I/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/include
-I/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0 -D_SVID_SOURCE
-D_BSD_SOURCE -DSHM -DHAVE_CONFIG_H   main.cpp linuxspec.cpp > .depend
i686-pc-linux-gnu-g++
-I/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/include
-I/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0 -O2
-march=pentium-m -pipe -fomit-frame-pointer -Wall -fPIC -fno-strict-aliasing
-O2 -DUSE_RANDR_EXT -DGL_GLEXT_PROTOTYPES -Wall -fPIC -fno-strict-aliasing -O2
-DUSE_RANDR_EXT -DGL_GLEXT_PROTOTYPES  -D_SVID_SOURCE -D_BSD_SOURCE -DSHM
-DHAVE_CONFIG_H  -c main.cpp
i686-pc-linux-gnu-g++
-I/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/include
-I/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0 -O2
-march=pentium-m -pipe -fomit-frame-pointer -Wall -fPIC -fno-strict-aliasing
-O2 -DUSE_RANDR_EXT -DGL_GLEXT_PROTOTYPES -Wall -fPIC -fno-strict-aliasing -O2
-DUSE_RANDR_EXT -DGL_GLEXT_PROTOTYPES  -D_SVID_SOURCE -D_BSD_SOURCE -DSHM
-DHAVE_CONFIG_H  -c linuxspec.cpp
i686-pc-linux-gnu-g++ main.o linuxspec.o
-L/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib -Wl,-O1
-Wl,--as-needed -Wl,--hash-style=gnu -L/usr/lib -lalut -L/usr/lib 
-lracescreens -lrobottools -lclient -lconfscreens -ltgf -ltgfclient -ltxml
-lplibul -lraceengine -llearning -lplibssgaux -lplibssg -lplibsm -lplibsl
-lplibsg -lplibul -lglut -lGLU -lGL -lpng -lz -ldl -lopenal -lXrandr -lXrender
-lXxf86vm -lXmu -lXi -lXt -lSM -lICE -lXext -lX11 -lm  -o torcs-bin
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libclient.so:
undefined reference to `ReSinglePlayerInit(void*)'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `XRRFreeScreenConfigInfo'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_create_read_struct'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_set_gamma'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgf.so:
undefined reference to `XML_ParserCreate'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `XRRSetScreenConfigAndRate'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_set_expand'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_get_gAMA'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_get_valid'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgf.so:
undefined reference to `XML_GetErrorCode'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgf.so:
undefined reference to `XML_SetUserData'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `XRRQueryExtension'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgf.so:
undefined reference to `XML_ExternalEntityParserCreate'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_init_io'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `XRRQueryVersion'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_set_gAMA'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `XRRConfigRates'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_set_filler'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_read_update_info'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgf.so:
undefined reference to `XML_SetExternalEntityRefHandler'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `XRRSelectInput'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_create_info_struct'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libclient.so:
undefined reference to `TorcsDriverMenuInit(void*)'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `XRRConfigCurrentRate'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_set_packing'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libclient.so:
undefined reference to `GraphMenuInit(void*)'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_set_strip_16'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_write_image'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgf.so:
undefined reference to `XML_GetCurrentLineNumber'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_write_flush'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_set_sig_bytes'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_read_image'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `XRRUpdateConfiguration'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_write_info'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgf.so:
undefined reference to `XML_ErrorString'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_create_write_struct'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `XRRConfigSizes'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_set_gray_to_rgb'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libclient.so:
undefined reference to `SoundMenuInit(void*)'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_set_IHDR'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `XRRConfigCurrentConfiguration'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgf.so:
undefined reference to `XML_ParserFree'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_sig_cmp'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_write_end'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_read_info'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgf.so:
undefined reference to `XML_SetElementHandler'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgf.so:
undefined reference to `XML_Parse'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `XRRGetScreenInfo'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_get_rowbytes'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_destroy_read_struct'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_get_IHDR'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libclient.so:
undefined reference to `OpenGLMenuInit(void*)'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_destroy_write_struct'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_set_invert_mono'
/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/export/lib/libtgfclient.so:
undefined reference to `png_set_swap'
collect2: ld returned 1 exit status
make[3]: *** [torcs-bin] Error 1
make[3]: Leaving directory
`/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/src/linux'
make[2]: *** [subdirs] Error 1
make[2]: Leaving directory
`/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0/src'
make[1]: *** [subdirs] Error 1
make[1]: Leaving directory
`/var/tmp/portage/games-sports/torcs-1.3.0/work/torcs-1.3.0'
make: *** [restart] Error 2


After removing --as-needed from LDFLAGS, torcs compiles as expected.

Here is my emerge --info:

Portage 2.1.4.4 (default/linux/x86/2008.0, gcc-4.1.2, glibc-2.6.1-r0, 2.6.26
i686)
=================================================================
System uname: 2.6.26 i686 Intel(R) Pentium(R) M processor 1.70GHz
Timestamp of tree: Mon, 14 Jul 2008 10:30:01 +0000
app-shells/bash:     3.2_p33
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python:     2.4.4-r13
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.2.5
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r2
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium-m -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf
/etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/terminfo
/etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -march=pentium-m -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer parallel-fetch sandbox sfperms strict
unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://mirror.pacific.net.au/linux/Gentoo
http://213.219.56.133/sites/www.ibiblio.org/gentoo/"
LC_ALL="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu"
LINGUAS="en"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress
--force --whole-file --delete --stats --timeout=180 --exclude=/distfiles
--exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/sunrise"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow X acl acpi alsa bash-completion bzip2 cairo cli cracklib crypt dri
dvd dvdr encode fortran gif gpm hdaps iconv isdnlog jpeg mad midi mmx mmxext
mp3 mudflap ncurses nls nptl nptlonly ogg opengl openmp pcre pdf png pppd
python readline reflection sdl session spl sse sse2 ssl svg tcpd truetype
unicode vorbis x86 xorg xv zlib" ALSA_CARDS="intel8x0" ALSA_PCM_PLUGINS="adpcm
alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa
lfloat linear meter mulaw multi null plug rate route share shm softvol"
APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm
authn_default authn_file authz_dbm authz_default authz_groupfile authz_host
authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir
disk_cache env expires ext_filter file_cache filter headers include info
log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling
status unique_id userdir usertrack vhost_alias" ELIBC="glibc"
INPUT_DEVICES="mouse keyboard synaptics" KERNEL="linux" LCD_DEVICES="bayrad
cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en"
USERLAND="GNU" VIDEO_CARDS="radeon vesa"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG,
PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

Thanks,
Marco

------- Comment #1 From Mr. Bones. 2008-07-31 19:55:16 0000 -------
I don't use --as-neeeded.  Submit a patch if it's something you think it
important please.

------- Comment #2 From Dannee McGuire 2008-09-05 20:23:24 0000 -------
Created an attachment (id=164657) [details]
torcs-1.3.0-as-needed.patch

------- Comment #3 From Dannee McGuire 2008-09-05 20:26:13 0000 -------
Created an attachment (id=164658) [details]
torcs-1.3.0.ebuild.patch

------- Comment #4 From Mr. Bones. 2008-09-05 21:12:27 0000 -------
Any chance you want to patch the TEXTRELs too?

TEXTREL usr/games/lib/torcs/lib/libconfscreens.so
TEXTREL usr/games/lib/torcs/lib/libtgfclient.so
TEXTREL usr/games/lib/torcs/lib/libclient.so
TEXTREL usr/games/lib/torcs/modules/simu/simuv2.so
TEXTREL usr/games/lib/torcs/modules/graphic/ssggraph.so

------- Comment #5 From Dannee McGuire 2008-09-05 22:11:36 0000 -------
That doesn't happen on my system, but you could try adding -fPIC after -shared
on both lines in that patch.

------- Comment #6 From Mr. Bones. 2008-09-05 23:14:05 0000 -------
Well, there's no reason to hold up this bug for it.  In portage.  Thanks for
the bug report and patch.