Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 128505 - apache2 fails to start with apr error when compiled with LDFLAGS="-Wl,--as-needed"
Summary: apache2 fails to start with apr error when compiled with LDFLAGS="-Wl,--as-ne...
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: x86 Linux
: High normal
Assignee: Apache Team - Bugzilla Reports
URL: http://www.gentoo.org/proj/en/qa/asne...
Whiteboard:
Keywords:
Depends on:
Blocks: as-needed
  Show dependency tree
 
Reported: 2006-04-02 05:09 UTC by Kim Nilsson
Modified: 2009-07-05 18:56 UTC (History)
6 users (show)

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


Attachments
files/apr-util-0.9.12-as-needed.patch (apr-util-0.9.12-as-needed.patch,792 bytes, patch)
2006-05-07 13:00 UTC, TGL
Details | Diff
apr-util-0.9.12-ebuild.patch (apr-util-0.9.12-ebuild.patch,364 bytes, patch)
2006-05-07 13:00 UTC, TGL
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kim Nilsson 2006-04-02 05:09:05 UTC
This is what the error msg looks like:

 * Apache2 has detected a syntax error in your configuration files:
/usr/sbin/apache2: symbol lookup error: /usr/lib/libaprutil-0.so.0: undefined symbol: gdbm_errno

Just re-emerging apr and apr-util without as-needed wasn't enough. I had to do the same with apache.

Portage 2.1_pre7-r3 (default-linux/x86/2005.1, gcc-3.4.6, glibc-2.3.5-r3, 2.6.15-gentoo-r7 i686)
=================================================================
System uname: 2.6.15-gentoo-r7 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz
Gentoo Base System version 1.12.0_pre16
dev-lang/python:     2.3.5, 2.4.2-r1
sys-apps/sandbox:    1.2.12
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-r3
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-mtune=pentium4 -march=pentium4 -O3 -pipe -fomit-frame-pointer"
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/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/eselect/compiler /etc/gconf /etc/splash /etc/terminfo /etc/env.d"
CXXFLAGS="-mtune=pentium4 -march=pentium4 -O3 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--alphabetical"
FEATURES="autoconfig distlocks metadata-transfer parallel-fetch sandbox sfperms strict"
GENTOO_MIRRORS="http://ftp.du.se/pub/os/gentoo http://trumpetti.atm.tut.fi/gentoo/ http://ds.thn.htu.se/linux/gentoo http://mirror.pudas.net/gentoo http://mirror.uni-c.dk/pub/gentoo/"
LC_ALL="en_GB.UTF-8"
LDFLAGS="-Wl,--as-needed"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/gentoo-webapps-overlay/experimental /usr/local/gentoo-webapps-overlay/production-ready /usr/local/gentoo-general-overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 7zip X a52 acpi alsa apm avi bcmath berkdb bitmap-fonts bzlib cdr crypt cups dri dvd dvdr eds emboss encode fam ffmpeg flac foomaticdb fortran ftp gdbm gif gnome gnutls gpm gstreamer gtk gtk2 imlib ipv6 isdnlog jpeg jpeg2k kde libg++ libwww lzo mad mikmod mmx motif mp3 mpeg ncurses network nls nptl nptlonly ogg oggvorbis opengl oss pam pdflib perl png pppd python qt quicktime readline samba sdl spell sse sse2 ssl tcpd theora truetype truetype-fonts type1-fonts udev unicode vorbis xinerama xml xml2 xmms xv zlib elibc_glibc kernel_linux userland_GNU"
Unset:  ASFLAGS, CTARGET, LANG, LINGUAS
Comment 1 Michael Stewart (vericgar) (RETIRED) gentoo-dev 2006-04-02 13:42:50 UTC
Need to look into this at some point. Attaching the URL that might help fix it.
Comment 2 Patrizio Bassi 2006-04-02 14:14:20 UTC
same here.
Comment 3 Mike Auty (RETIRED) gentoo-dev 2006-04-03 11:10:48 UTC
Apache and apr-util rebuild and then start fine with the gdbm USE flag turned off but with LDFLAGS="-Wl,--as-needed".
Comment 4 Jakub Moc (RETIRED) gentoo-dev 2006-04-03 11:14:04 UTC
(In reply to comment #3)
> Apache and apr-util rebuild and then start fine with the gdbm USE flag turned
> off but with LDFLAGS="-Wl,--as-needed".

OK, so it only breaks when you emerge dev-libs/apr-util with USE="gdbm" and --as-needed?
Comment 5 Patrizio Bassi 2006-04-06 04:44:56 UTC
no jacub, i tried to compiled without as-needed apr and aprutils, and apache with that flag.

fails. only apache must filter it (or better...fix the linking).
Comment 6 TGL 2006-05-07 12:55:34 UTC
The numerous unresolved symbols in libaprutil-0.so are easy to fix (i will attach a patch). It is a required step toward building apache with --as-needed, since this flag (with recent binutils) prevents linking against an incomplete library.

But then there is a much more serious issue: none of the apache modules are linked to any of the libs they use. They instead rely on apache2 providing all the symbols they need. Usually, apache2 is linked to all the libraries used by at least one module, and loading works fine.  But if apache is built with --as-needed, some of this libs  (the ones apache2 doesn't directly use - libcrypto, libssl and libz here) are dropped, and you get unresolved symbols errors at runtime, when some of the modules are loaded.
Fixing that would be, imho, a rather tedious work, for a very minor benefit, and thus filter-ldflags has my vote for this one.
Comment 7 TGL 2006-05-07 13:00:12 UTC
Created attachment 86390 [details, diff]
files/apr-util-0.9.12-as-needed.patch
Comment 8 TGL 2006-05-07 13:00:41 UTC
Created attachment 86391 [details, diff]
apr-util-0.9.12-ebuild.patch
Comment 9 Michael Stewart (vericgar) (RETIRED) gentoo-dev 2006-05-18 11:19:20 UTC
--as-needed filtered in apache, apr, and apr-util
closing.
Comment 10 Patrizio Bassi 2006-05-18 11:38:54 UTC
filtered?? please CC diego and ask him.
he told: never filter that linking flag.

this is not a solution, this is a bypass.
Comment 11 Jakub Moc (RETIRED) gentoo-dev 2006-05-18 11:43:50 UTC
(In reply to comment #10)
> filtered?? please CC diego and ask him.
> he told: never filter that linking flag.
> 
> this is not a solution, this is a bypass.

Did you really read Comment #6 ?
Comment 12 Patrizio Bassi 2006-05-18 23:44:41 UTC
sure.
--as-needed fix is always boring and long, as comment #6 complains.
Comment 13 Michael Stewart (vericgar) (RETIRED) gentoo-dev 2006-05-19 20:57:34 UTC
If deigo (or someone else) wants to figure out all the intradependencies of apache, apr, apr-util, and every single apache module in the tree, and provide patches to make it all work nicely with --as-needed, then I will apply those patches. Right now, --as-needed is a flag in the minority and the effort to make apache work with it is more effort then it is worth.

Read again: apache does not link against all the libraries it uses - it relies on apr and/or apr-util exporting many of the symbols, even though apr and apr-util may not use those libraries. Modules to apache have the same relationship to apache and apr and apr-util. It's rather complex. apr and apr-util used to be bundled with apache itself, only recently has it been able to be seperated out. There is still lots of intradependence and linking that needs to be cleaned up.
Comment 14 Stefan Schweizer (RETIRED) gentoo-dev 2006-06-05 09:59:47 UTC
this is not FIXED, CCing Flameeyes. Please leave the filtering in place until it is correctly fixed.
Comment 15 Stefan Schweizer (RETIRED) gentoo-dev 2006-09-01 08:40:33 UTC
later versions >=net-www/apache-2.2.0 are fixed
Comment 16 Hanno Böck gentoo-dev 2009-06-06 14:26:59 UTC
The filter-flags command still exists in apache-tools -> I assume it was just forgotten to be removed?
Comment 17 Benedikt Böhm (RETIRED) gentoo-dev 2009-06-28 17:40:07 UTC
it is also present in apache-2.eclass line 452, is there a problem with it?