Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 269513 - dev-games/flatzebra does not link properly with --as-needed
Summary: dev-games/flatzebra does not link properly with --as-needed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Games (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords:
: 272657 (view as bug list)
Depends on:
Blocks: as-needed
  Show dependency tree
 
Reported: 2009-05-12 08:27 UTC by Martin Väth
Modified: 2009-06-23 16:11 UTC (History)
2 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 Martin Väth 2009-05-12 08:27:07 UTC
burgerspace-1.8.3 does not link against dev-games/flatzebra-0.1.2 with
LDFLAGS="-Wl,--as-needed".

(Note that it _does_ link even with gcc-4.4 if -Wl,--as-needed is not in the
LDFLAGS, although --as-need is supposed to be implicit there - I have not
examined why this happens).

Anyway, IMHO it is not correct to fail wit -Wl,--as-needed. A fix is to specify
in flatzebra-0.1.2 the required libraries as described in bug 269276.
I suppose that also bug 131839 is related since the patch is applied only in
the dev-games/flatzebra-0.1.1 ebuild (I didn't try that patch yet, but it
might be necessary to specify -lSDL in addition for flatzebra-0.1.2).
Comment 1 Martin Väth 2009-05-12 08:32:39 UTC
BTW: It does not matter whether --as-needed is in LDFLAGS
during compilation of flatzebra, it is only important whether it is there
during compilation of burgerspace.

Here comes the relevant part of the compilation and the
"env -i emerge --info" used for the compilation:

x86_64-pc-linux-gnu-g++ -DPKGSOUNDDIR=\"/usr/share/games/burgerspace\" -I../src/images -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/flatzebra-0.1 -I/usr/include/SDL   -march=native -O2 -fno-ident -pipe -Wall  -Wl,--as-needed -o burgerspace burgerspace-BurgerSpaceEngine.o burgerspace-IngredientGroup.o burgerspace-EnemySprite.o burgerspace-sdlmain.o -lflatzebra-0.1 -lSDL -lpthread -lSDL_image -lSDL_mixer   
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0/../../../../lib64/libflatzebra-0.1.so: undefined reference to `Mix_CloseAudio'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0/../../../../lib64/libflatzebra-0.1.so: undefined reference to `Mix_PlayChannelTimed'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0/../../../../lib64/libflatzebra-0.1.so: undefined reference to `Mix_FreeChunk'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0/../../../../lib64/libflatzebra-0.1.so: undefined reference to `Mix_OpenAudio'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0/../../../../lib64/libflatzebra-0.1.so: undefined reference to `Mix_AllocateChannels'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0/../../../../lib64/libflatzebra-0.1.so: undefined reference to `Mix_Volume'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0/../../../../lib64/libflatzebra-0.1.so: undefined reference to `IMG_ReadXPMFromArray'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0/../../../../lib64/libflatzebra-0.1.so: undefined reference to `Mix_LoadWAV_RW'

env -i emerge --info:

Portage 2.2_rc33 (default/linux/amd64/2008.0/desktop, gcc-4.4.0, glibc-2.9_p20081201-r2, 2.6.29-hardened x86_64)
=================================================================
System uname: Linux-2.6.29-hardened-x86_64-Intel-R-_Pentium-R-_Dual_CPU_E2200_@_2.20GHz-with-glibc2.2.5
Timestamp of tree: Mon, 11 May 2009 17:15:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     4.0_p17-r1
dev-java/java-config: 2.1.7
dev-lang/python:     2.5.4-r2
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.6.2-r1
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.4.3-r2
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.63
sys-devel/automake:  1.7.9999, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.19.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.29
ABI="amd64"
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* DOOM3 PUEL RTCW RTCW-ETEULA"
ALSA_CARDS="bt87x mpu401 seqdummy serialmidi serial-u16550 hda-intel virmidi"
ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol"
ANT_HOME="/usr/share/ant"
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"
ARCH="amd64"
ASFLAGS_x86="--32"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CDEFINE_amd64="__x86_64__"
CDEFINE_x86="__i386__"
CFLAGS="-march=native -O2 -fno-ident -pipe"
CFLAGS_x86="-m32"
CHOST="x86_64-pc-linux-gnu"
CHOST_amd64="x86_64-pc-linux-gnu"
CHOST_x86="i686-pc-linux-gnu"
CLEAN_DELAY="5"
COLLISION_IGNORE="/lib/modules"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"
CVS_RSH="ssh"
CXXFLAGS="-march=native -O2 -fno-ident -pipe"
DEFAULT_ABI="amd64"
ELIBC="glibc"
EMERGE_DEFAULT_OPTS="--verbose --nospinner --with-bdeps y --keep-going"
EMERGE_WARNING_DELAY="10"
FEATURES="candy ccache collision-protect distlocks fixpackages sandbox sfperms strict unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg"
FLTK_DOCDIR="/usr/share/doc/fltk-1.1.7-r2/html"
FRACTDIR="/usr/share/xfractint"
GCC_SPECS=""
GDK_USE_XFT="1"
GUILE_LOAD_PATH="/usr/share/guile/1.8"
HG="/usr/bin/hg"
INFOPATH="/usr/share/info:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.19.1/info:/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.0/info:/usr/share/info/emacs-22"
INPUT_DEVICES="evdev keyboard mouse"
JAVACC_HOME="/usr/share/javacc/"
KDE_MALLOC="1"
KDE_NO_IPV6="1"
KERNEL="linux"
LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text"
LDFLAGS="-Wl,--as-needed"
LDFLAGS_x86="-m elf_i386"
LESS="-sFR -iMX --shift 5"
LIBDIR_amd64="lib64"
LIBDIR_amd64_fbsd="lib64"
LIBDIR_ppc="lib32"
LIBDIR_ppc64="lib64"
LIBDIR_sparc32="lib32"
LIBDIR_sparc64="lib64"
LIBDIR_x86="lib32"
LIBDIR_x86_fbsd="lib32"
LINGUAS="en en_US de de_DE"
LIRC_DEVICES="pctv"
MAKEOPTS="-j3"
MANPATH="/usr/local/share/man:/usr/share/man:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.19.1/man:/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.0/man:/etc/java-config/system-vm/man/:/usr/kde/3.5/share/man:/usr/qt/3/doc/man:/opt/opera/share/man"
MULTILIB_ABIS="amd64 x86"
MULTILIB_STRICT_DENY="64-bit.*shared object"
MULTILIB_STRICT_DIRS="/lib32 /lib /usr/lib32 /usr/lib /usr/kde/*/lib32 /usr/kde/*/lib /usr/qt/*/lib32 /usr/qt/*/lib /usr/X11R6/lib32 /usr/X11R6/lib"
MULTILIB_STRICT_EXEMPT="(perl5|gcc|gcc-lib|binutils|eclipse-3|debug|portage)"
MY_RSYNC_EXCLUDEFROM="/home/gentoo/various/etc/portage/rsync_excludes"
NETBEANS="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml"
NOCOLOR="true"
OPENGL_PROFILE="nvidia"
PATH="/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.0:/usr/kde/3.5/bin:/usr/qt/3/bin:/usr/games/bin"
PKGDIR="/big/gentoo/x86_64"
PKG_CONFIG_PATH="/usr/qt/3/lib64/pkgconfig"
PORTAGE_ARCHLIST="ppc s390 amd64 x86 ppc64 x86-fbsd m68k arm sparc sh mips ia64 alpha hppa amd64-fbsd sparc-fbsd"
PORTAGE_BINHOST_CHUNKSIZE="3000"
PORTAGE_BIN_PATH="/usr/lib64/portage/bin"
PORTAGE_COMPRESS="xz"
PORTAGE_COMPRESS_EXCLUDE_SUFFIXES="css gif htm[l]? jp[e]?g js pdf png"
PORTAGE_COMPRESS_FLAGS="--best --extreme"
PORTAGE_CONFIGROOT="/"
PORTAGE_DEBUG="0"
PORTAGE_DEPCACHEDIR="/var/cache/edb/dep"
PORTAGE_ELOG_CLASSES="log warn error"
PORTAGE_ELOG_MAILFROM="portage@localhost"
PORTAGE_ELOG_MAILSUBJECT="[portage] ebuild log for ${PACKAGE} on ${HOST}"
PORTAGE_ELOG_MAILURI="root"
PORTAGE_ELOG_SYSTEM="echo save"
PORTAGE_FETCH_CHECKSUM_TRY_MIRRORS="5"
PORTAGE_FETCH_RESUME_MIN_SIZE="350K"
PORTAGE_GID="250"
PORTAGE_INST_GID="0"
PORTAGE_INST_UID="0"
PORTAGE_IONICE_COMMAND="ionice -c 3 -p ${PID}"
PORTAGE_NICENESS="9"
PORTAGE_PYM_PATH="/usr/lib64/portage/pym"
/rsync_excludes"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_RSYNC_RETRIES="3"
PORTAGE_TMPDIR="/var/tmp"
PORTAGE_VERBOSE="1"
PORTAGE_WORKDIR_MODE="0700"
PORT_LOGDIR="/var/log/portage"
PROFILE_ONLY_VARIABLES="ARCH ELIBC KERNEL USERLAND"
PYTHONDOCS="/usr/share/doc/python-docs-2.5.1/html/lib"
QMAKESPEC="linux-g++"
QTDIR="/usr/qt/3"
RESUMECOMMAND="/usr/bin/wget -c -t 5 -T 60 --passive-ftp -O "${DISTDIR}/${FILE}" "${URI}""
ROOT="/"
ROOTPATH="/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.0:/usr/kde/3.5/sbin:/usr/kde/3.5/bin:/usr/qt/3/bin"
RPMDIR="/usr/portage/rpm"
SANE_BACKENDS="mustek_pp"
STAGE1_USE="multilib nptl nptlonly unicode"
SYMLINK_LIB="yes"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
TRICKYLOG="/var/tmp/portage/trickyfetch.log"
USE="16bit 64bit 7zip S3TC X a52 aac aalib ace acpi adplug aften alsa amd64 amr amrnb amrr amrwb aotuv archive arpack artist-screen ass audio audiofile audioscrobbler avfs avg bazaar berkdb binary-drivers binfilter bittorrent bl blas branding bzip2 caps cblas cdaudio cdda cddax cdparanoia cdr cdrom cdrtools cdsound cg checkpath chipcard cmake colordiff colors compress config_wizard cpio crypt css cuda custom-cflags custom-cpuopts custom-cxxflags custom-optimization demo detex dga dirac discard-path divx djvu double-precision downloadorder dri dtaus dts dv dvd dvdnav dvdr dvdread dvi2tty dynamic ebook ecc encode escreen extra-algorithms extra-tools extras faac faad fame fat ffmpeg firefox fix-connected-rt flac force-cgi-redirect force-reg fortran fortran95 gcj gdbm geldkarte gencertdaily gif gimp ginac git glibc-omitfp glitz gmedia gmp gnutella gpg gpm grammar graphics graphite grub gs gsm gtk gzip-el hal hardened hbci hddtemp hdri help-screen hwmixer hyperspec ibam id3 id3tag idea ieee1394 ilbc imap int64 ipfilter ipsec java java-external java6 jbig jce jpeg jpeg2k kde kde4 kdehiddenvisibility kmid kpathsea lame lastfmradio latex levels libcaca libgcrypt lights lirc live log4j login-watch logitech-mouse logrotate long-double loop-playback lyrics-screen lzma lzo mad matroska mbox metric midi mikmod mime mimencode mjpeg mmx mng mode-paranoid mods motif mozilla moznocompose moznoirc moznopango moznoxft mp2 mp3 mp3rtp mp4 mp4live mpeg mpeg2 mplayer mschap mudflap multilib musepack nat ncurses nemesi new-interface new-reg-alloc nls nocd nolvmstatic nowin npp nptl nptlonly nsplugin nuv nvidia nvtv nxclient oci8-instant-client octave offensive ogg ogm openal openexr opengl openipmi openmp openstreetmap otr pager pari patch pcre pdf perl pgf pic png pnm pop portage posix postproc postscript preview-latex projectx ps pstoedit python qa qmax qt3support qt4 quicktime radio rar rc5 readline remix replaygain resid resolvconf restrict-javascript rle roe rogue rtsp scenarios schroedinger screen scrobbler sdl sdl-image sdlaudio sha512 shout sid skins smime song-screen songs sou speex spell srt sse sse2 sse3 ssl ssp ssse3 stlport stream subtitles subversion svk sysfs system-libs tagwriting teletext tex tex4ht textures themes theora thesaurus threads threadsafe tiff timidity toolkit-scroll-bars truetype tta twolame type3 underscores unicode usb userlocales uudeview uuencode v4l v4l2 vamp vcd vcdx vdpau videos voice vorbis vorbis-psy wav wavpack weak-algorithms wma wmf wmp wordperfect wv2 x264 xanim xatrix xcomposite xext xgetdefault xindy xine xiph xlockrc xorg xpm xrandr xscreensaver xterm xulrunner xv xvid xvmc yaepg yv12 zip zlib zsh-completion zvbi" ALSA_CARDS="bt87x mpu401 seqdummy serialmidi serial-u16550 hda-intel virmidi" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul 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="evdev keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_US de de_DE" LIRC_DEVICES="pctv" USERLAND="GNU" VIDEO_CARDS="nv nvidia v4l"
USERLAND="GNU"
USE_EXPAND="ALSA_CARDS ALSA_PCM_PLUGINS APACHE2_MODULES APACHE2_MPMS CAMERAS CROSSCOMPILE_OPTS DVB_CARDS ELIBC FCDSL_CARDS FOO2ZJS_DEVICES FRITZCAPI_CARDS INPUT_DEVICES KERNEL LCD_DEVICES LINGUAS LIRC_DEVICES MISDN_CARDS NETBEANS_MODULES USERLAND VIDEO_CARDS"
USE_EXPAND_HIDDEN=""
USE_ORDER="env:pkg:conf:defaults:pkginternal:env.d"
VESA="no"
VIDEO_CARDS="nv nvidia v4l"
XDG_CONFIG_DIRS="/etc/xdg"
XDG_DATA_DIRS="/usr/local/share:/usr/share:/usr/kde/3.5/share"
XERCESC_NLS_HOME="/usr/share/xerces-c/msg"

Comment 2 Mr. Bones. (RETIRED) gentoo-dev 2009-05-12 16:42:09 UTC
-lSDL_image -lSDL_mixer are right there on the link line so how is this related to --as-needed
Comment 3 Martin Väth 2009-05-12 18:30:38 UTC
(In reply to comment #2)
> -lSDL_image -lSDL_mixer are right there on the link line so how is this
> related to --as-needed

The unresolved symbols are not referred in the .o-files of that line but
only the flatzebra-0.1 library which claims that it does not need SDL_image
and SDL_mixer as you can see by
   ldd /usr/lib/libflatzebra-0.1.so
As I understand, it is the purpose of --as-needed to not establish such
implicit dependencies.
The linking works if the -lSDL_image -lSDL_mixer are put on the command line
before -Wl,--as-needed (because then they are not subject to --as-needed),
but this is only a hack:
The real problem is that the ldd-command above does not list all actual
dependencies of flatzabra-1.0.

(BTW: I just observed that libSDL is listed in the above commmand, so
the -lSDL which I mentioned in bug 269276 is not needed; but -lSDL_image and
-lSDL_mixer are missing in the final linkflags of libflatzebra-0.1)
Comment 4 Pierre Sarrazin 2009-05-16 17:51:12 UTC
Hi. I'm the author of BurgerSpace and FlatZebra.

Adding this line to configure.ac, right after the TRY_LINK_SDL_MIXER line,
seems to make the needed difference:

SDL_LIBS="$SDL_LIBS -lSDL_image -lSDL_mixer"

This will insert "-lSDL_image -lSDL_mixer" in the dependency_libs field
of the installed .la file. The flatzebra shared library will also
specify SDL_image and SDL_mixer as being needed (according to ldd).

I will integrate this change in my version, unless there is a better
or cleaner solution.

I'd like to know if this change alone solves the original problem.
Comment 5 Tristan Heaven (RETIRED) gentoo-dev 2009-06-04 17:59:29 UTC
*** Bug 272657 has been marked as a duplicate of this bug. ***
Comment 6 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-06-04 18:03:28 UTC
Sorry I didn't see this but I was looking for bugs for the correct package (flatzebra); the library does not link properly against the libraries it needs, that's why burgerspace fails; it should be fixed in flatzebra not in burgerspace.
Comment 7 Pierre Sarrazin 2009-06-22 01:35:25 UTC
I have just published flatzebra 0.1.3, which contains the fix described in Comment #4:

http://sarrazip.com/dev/flatzebra-0.1.3.tar.gz

The MD5 sum is 4f595c64e4ef2c82a2da4d420eacea1a.
Comment 8 Mr. Bones. (RETIRED) gentoo-dev 2009-06-23 16:11:02 UTC
ok, fixed in flatzebra 0.1.3