Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 276571 - dev-libs/libmemcache: fails with undefined symbols w/ forced --as-needed
Summary: dev-libs/libmemcache: fails with undefined symbols w/ forced --as-needed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High QA (vote)
Assignee: Robin Johnson
URL: http://www.gentoo.org/proj/en/qa/asne...
Whiteboard:
Keywords:
Depends on:
Blocks: as-needed 327725
  Show dependency tree
 
Reported: 2009-07-05 11:59 UTC by Diego Elio Pettenò (RETIRED)
Modified: 2010-07-10 20:43 UTC (History)
2 users (show)

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


Attachments
fix "undefined reference" errors due to symbols not being exported (libmemcache-inline-symbols.patch,1.53 KB, patch)
2009-08-12 21:38 UTC, Ștefan Talpalaru
Details | Diff
libmemcache-1.4.0_rc2-inline.patch (libmemcache-1.4.0_rc2-inline.patch,2.16 KB, patch)
2010-04-22 04:50 UTC, Ryan Hill (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Elio Pettenò (RETIRED) gentoo-dev 2009-07-05 11:59:14 UTC
I'm reporting this bug because the package in summary fails to build when forcing --as-needed on through spec files (check out http://blog.flameeyes.eu/2008/11/14/problems-and-mitigation-strategies-for-as-needed for details).

Please note that this bug _might_ apply to -Wl,--as-needed in LDFLAGS as well; in both cases it should be fixed. Also, if this is due to the package in question not respecting user-defined LDFLAGS, you should get to fix that too.

Check the attached build log.

Thanks,
Diego

configure:12417: i686-pc-linux-gnu-gcc -o conftest -O2 -pipe  -Wl,-O1 conftest.c -lmemcache  -ldl  >&5
/usr/lib/gcc/i686-pc-linux-gnu/4.4.0/../../../libmemcache.so: undefined reference to `mcm_buf_len'
/usr/lib/gcc/i686-pc-linux-gnu/4.4.0/../../../libmemcache.so: undefined reference to `mcm_buf_remain_off'
Comment 1 Ștefan Talpalaru 2009-08-12 21:38:06 UTC
Created attachment 201084 [details, diff]
fix "undefined reference" errors due to symbols not being exported

The problem is not related to --as-needed. Some functions have the 'inline' keyword both in the header and in the function definition and gcc ends up not creating the symbol at all in the final library leading to link time errors (at least gcc-4.4.1 which is what I'm using).

The solution is to simply remove 'inline' from the header. The attached patch was tested by adding 'epatch "${FILESDIR}/${PN}-inline-symbols.patch"' to the end of src_unpack().
Comment 2 Samuli Suominen (RETIRED) gentoo-dev 2010-03-06 20:36:06 UTC
Exactly what version is failing here? I've just emerged libmemcache-1.4.0.rc2 from ~arch without any need for patch w/ GCC 4.4.3
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2010-03-24 22:07:16 UTC
I can't reproduce either.
Comment 4 Ryan Hill (RETIRED) gentoo-dev 2010-04-22 04:38:40 UTC
i can here:

libtool: compile:  x86_64-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I.. -I../include -std=c99 -O2 -march=native -fomit-frame-pointer -pipe -Wall -pipe -Wpacked -Wdisabled-optimization -MT buffer.lo -MD -MP -MF .deps/buffer.Tpo -c buffer.c  -fPIC -DPIC -o .libs/buffer.o
memcache.c:45:2: warning: #warning "Working around busted-ass Linux header include problems: use FreeBSD instead"
memcache.c:46:2: warning: #warning "http://www.FreeBSD.org/ - you won't regret it"
memcache.c:283:11: warning: 'mcGlobalCtxt' is static but used in inline function 'mc_global_ctxt' which is not static
../include/memcache/buffer.h:73:15: warning: inline function 'mcm_buf_remain_off' declared but never defined
../include/memcache/buffer.h:72:15: warning: inline function 'mcm_buf_remain' declared but never defined
../include/memcache/buffer.h:66:18: warning: inline function 'mcm_buf_len' declared but never defined
../include/memcache/buffer.h:73:15: warning: inline function 'mcm_buf_remain_off' declared but never defined
../include/memcache/buffer.h:72:15: warning: inline function 'mcm_buf_remain' declared but never defined
../include/memcache/buffer.h:66:18: warning: inline function 'mcm_buf_len' declared but never defined

libtool: compile:  x86_64-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I.. -I../include -std=c99 -O2 -march=native -fomit-frame-pointer -pipe -Wall -pipe -Wpacked -Wdisabled-optimization -MT memcache.lo -MD -MP -MF .deps/memcache.Tpo -c memcache.c -o memcache.o >/dev/null 2>&1
../include/memcache.h:926:30: warning: inline function 'mc_global_ctxt' declared but never defined
../include/memcache.h:926:30: warning: inline function 'mc_global_ctxt' declared but never defined


which ends up causing:

libtool: link: x86_64-unknown-linux-gnu-gcc -std=c99 -O2 -march=native -fomit-frame-pointer -pipe -Wall -pipe -Wpacked -Wdisabled-optimization -Wl,-O1 -o .libs/benchmark benchmark.o  -L/var/tmp/portage/dev-libs/libmemcache-1.4.0_rc2-r1/work/libmemcache-1.4.0.rc2/src /var/tmp/portage/dev-libs/libmemcache-1.4.0_rc2-r1/work/libmemcache-1.4.0.rc2/src/.libs/libmemcache.so
/var/tmp/portage/dev-libs/libmemcache-1.4.0_rc2-r1/work/libmemcache-1.4.0.rc2/src/.libs/libmemcache.so: undefined reference to `mcm_buf_len'
/var/tmp/portage/dev-libs/libmemcache-1.4.0_rc2-r1/work/libmemcache-1.4.0.rc2/src/.libs/libmemcache.so: undefined reference to `mcm_buf_remain_off'
collect2: ld returned 1 exit status
Comment 5 Ryan Hill (RETIRED) gentoo-dev 2010-04-22 04:50:17 UTC
Created attachment 228685 [details, diff]
libmemcache-1.4.0_rc2-inline.patch
Comment 6 Ryan Hill (RETIRED) gentoo-dev 2010-04-22 04:50:48 UTC
Portage 2.2_rc67 (default/linux/amd64/10.0/developer, gcc-4.5.1-pre9999, glibc-2.11-r1, 2.6.33-gentoo-r1 x86_64)
=================================================================
System uname: Linux-2.6.33-gentoo-r1-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T9300_@_2.50GHz-with-gentoo-2.0.1
Timestamp of tree: Wed, 21 Apr 2010 01:30:01 +0000
ccache version 3.0pre0 [enabled]
app-shells/bash:     4.1_p5
dev-java/java-config: 2.1.10
dev-lang/python:     2.5.4-r4, 2.6.5-r1, 3.1.2-r2
dev-util/ccache:     3.0_pre0
dev-util/cmake:      2.8.1-r1
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.1-r1
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.13, 2.65
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1
sys-devel/gcc:       4.3.4, 4.4.3, 4.4.4_pre9999, 4.5.1_pre9999
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.33
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-unknown-linux-gnu"
CFLAGS="-O2 -march=native -fomit-frame-pointer -pipe"
CHOST="x86_64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /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"
CXXFLAGS="-O2 -march=native -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests ccache cvs distlocks fixpackages multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms sign split-log splitdebug strict test test-fail-continue unmerge-orphans userfetch userpriv usersandbox usersync"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distfiles.gentoo.org/"
LANG="en_US.utf8"
LC_ALL="en_US.utf8"
LDFLAGS="-Wl,-O1"
LINGUAS="en en_US"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--timeout=90"
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="/home/dirtyepic/svn/gcc-porting /home/dirtyepic/svn/toolchain /home/dirtyepic/svn/dirtyepic /home/dirtyepic/overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac acpi akonadi alsa amd64 archive ass autotrace avahi bash-completion berkdb bonjour bs2b bzip2 cairo ccache cdaudio cdda cddb cdio cdr cli consolekit cracklib crypt css cups curl custom-cflags cvs cxx dbus device-mapper dirac disk-partition djvu dri dts dvd dvdnav dvdr emboss emf enca encode exif expat faac faad fam ffmpeg fftw firefox firefox3 flac fontconfig fontforge fts3 gdbm gif git gmp gmplayer gold graphite graphviz gstreamer gtk guidexml hal iconv id3tag imap inotify jadetex java jpeg jpeg2k kde kdehiddenvisibility kipi lame laptop lastfm lastfmradio libburn libmms libnotify lightning lzma mad maildir mdnsresponder-compat mmap mmx mmxext mng modules mp2 mp3 mp4 mpeg mplayer multilib musicbrainz nautilus ncurses network-cron nntp nptl nptlonly nsplugin ogg opengl openmp openssl optimized-qmake osdmenu pam pango pcre pdf perl phonon pic plotutils png ppds pppd python qt3support qt4 quicktime rar readline reflection replytolist rtc schroedinger scrobbler session shm smp sndfile snmp sound sox spell spl sse sse2 sse3 ssl ssse3 startup-notification subversion svg sysfs taglib tcpd theora threads threadsafe thumbnail tiff tremor truetype unicode urandom usb utempter vim-syntax vim-with-x vorbis wicd wifi wma wmf wxwidgets wxwindows x264 xattr xcb xcomposite xft xml xmlpatterns xmp xorg xulrunner xv xvid xvmc zip zlib" ALSA_CARDS="hda-intel" 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 synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_US" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS
Comment 7 Ryan Hill (RETIRED) gentoo-dev 2010-04-22 04:52:02 UTC
with gcc-4.4.2 it fails during configure as Diego reported.
Comment 8 Samuli Suominen (RETIRED) gentoo-dev 2010-07-10 20:21:41 UTC
reproduced, this time with gcc-4.5.0

+  10 Jul 2010; Samuli Suominen <ssuominen@gentoo.org>
+  libmemcache-1.4.0_rc2-r1.ebuild,
+  +files/libmemcache-1.4.0_rc2-inline.patch:
+  Export required symbols wrt #276571 by Ryan Hill.