Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 143580 - sys-libs/gdbm patch for use with --as-needed
Summary: sys-libs/gdbm patch for use with --as-needed
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: XEmacs team
Depends on:
Blocks: as-needed
  Show dependency tree
Reported: 2006-08-11 08:29 UTC by David Philippi
Modified: 2006-12-10 03:42 UTC (History)
4 users (show)

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

gdbm-1.8.3-as-needed.patch (gdbm-1.8.3-as-needed.patch,433 bytes, patch)
2006-09-03 01:21 UTC, Hans de Graaff
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Philippi 2006-08-11 08:29:11 UTC
When using this flag configure failed on "checking for dbm_open in -lgdbm_compat using extra libs -lgdbm...". Once I removed --as-needed from my LDFLAGS it found it and the compile went through completely. I changed nothing else in between so it's obvious that it's the culprit.

emerge --info for completeness sake:

Portage 2.1.1_pre4-r4 (default-linux/amd64/2006.0, gcc-4.1.1/amd64-vanilla, glibc-2.4-r3, 2.6.17-gentoo-r2 x86_64)
System uname: 2.6.17-gentoo-r2 x86_64 AMD Athlon(tm) 64 Processor 3500+
Gentoo Base System version 1.12.4
Last Sync: Thu, 10 Aug 2006 11:20:01 +0000
ccache version 2.4 [enabled]
app-admin/eselect-compiler: 2.0.0_rc2-r1
dev-lang/python:     2.4.3-r1
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r2
dev-util/confcache:  [Not Present]
sys-devel/autoconf:  2.13, 2.60
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.17
sys-devel/gcc-config: 2.0.0_rc1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.16
ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-march=k8 -O3 -msse3 -ftree-vectorize"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/lib64/mozilla/defaults/pref /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/eselect/compiler /etc/gconf /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-march=k8 -O3 -msse3 -fvisibility-inlines-hidden -ftree-vectorize"
FEATURES="autoconfig ccache distlocks metadata-transfer parallel-fetch sandbox sfperms strict"
LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed"
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'"
USE="amd64 X a52 aac alsa avi bash-completion berkdb bitmap-fonts bzip2 cdr cli crypt cups dbus dlloader dri dvb dvd eds elibc_glibc emboss encode ffmpeg foomaticdb fortran gif gpm gstreamer gtk2 hal imlib input_devices_evdev input_devices_keyboard input_devices_mouse isdnlog jpeg kde kdeenablefinal kdehiddenvisibility kdenewldflags kernel_linux linguas_de lzw lzw-tiff mad mp3 mpeg ncurses nls nptl nptlonly ogg opengl pam pcre pdflib perl png pppd python qt qt3 qt4 quicktime readline reflection samba sdl session spell spl sse3 ssl tcpd theora tiff truetype-fonts type1-fonts unicode usb userland_GNU userlocales video_cards_nv vorbis x264 xorg xpm xv xvid zlib"
Comment 1 Hans de Graaff gentoo-dev 2006-08-13 02:16:49 UTC
Please note that the database support of xemacs-21.4.19 as it is in portage is considered broken. Detection does not work well, especially not with newer versions of berkdb and gdbm and berkdb are jumbled together in a strange way so that the berkdb flag may in fact result in gdbm being used.

A newer version of the xemacs ebuild with updated database patches is available from my subversion overlay: 
This version splits out berkdb and gdbm support and has additional configure support for newer versions of berkdb. I could run configure there using 
USE="gdbm berkdb" LDFLAGS="-Wl,--as-needed" emerge xemacs

Hopefully this version of the ebuild will be in portage soon as I am currently on track to become a developer.
Comment 2 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2006-08-27 11:44:40 UTC
i have a similar error, Im unsure if it should be part of the same bug or not. 

configure passes fine ( even with gentoos official tree ) 

but both gentoos and your patched versions screw up at the very last link ( at least for me ) 

gcc -c -O2 -march=i686 -mtune=athlon-xp -pipe -ggdb  -Demacs -I. -DHAVE_CONFIG_H -I/usr/X11R6/include dump-id.c
gcc -O2 -march=i686 -mtune=athlon-xp -pipe -ggdb  -Wl,-O1,-z,combreloc,--as-needed,--sort-common,--enable-new-dtags -L/usr/X11R6/lib -Wl,-export-dynamic -o xemacs  abbrev.o alloc.o blocktype.o buffer.o bytecode.o callint.o callproc.o casefiddle.o casetab.o chartab.o cmdloop.o cmds.o console.o console-stream.o data.o device.o dired.o doc.o doprnt.o dynarr.o editfns.o elhash.o emacs.o eval.o events.o filelock.o dumper.o balloon_help.o balloon-x.o dragdrop.o eldap.o postgresql.o menubar.o scrollbar.o dialog.o toolbar.o menubar-x.o scrollbar-x.o dialog-x.o toolbar-x.o gui-x.o mule.o mule-ccl.o mule-charset.o file-coding.o input-method-motif.o realpath.o inline.o linuxplay.o nas.o esd.o miscplay.o console-tty.o device-tty.o event-tty.o frame-tty.o objects-tty.o redisplay-tty.o cm.o terminfo.o gpmevent.o event-unixoid.o database.o sysdll.o emodules.o process-unix.o event-stream.o extents.o faces.o fileio.o  filemode.o floatfns.o fns.o font-lock.o frame.o general.o glyphs.o glyphs-eimage.o glyphs-widget.o gui.o gutter.o  hash.o imgproc.o indent.o insdel.o intl.o keymap.o  line-number.o lread.o lstream.o macros.o marker.o md5.o minibuf.o objects.o opaque.o print.o process.o profile.o rangetab.o redisplay.o redisplay-output.o regex.o search.o select.o  signal.o sound.o specifier.o strftime.o symbols.o syntax.o sysdep.o undo.o console-x.o device-x.o event-Xt.o frame-x.o glyphs-x.o objects-x.o redisplay-x.o select-x.o xgccache.o widget.o window.o  lastfile.o vm-limit.o  EmacsFrame.o EmacsShell.o TopLevelEmacsShell.o TransientEmacsShell.o EmacsManager.o  offix.o dump-id.o ../lwlib/liblw.a  -laudio -lXm -lXaw3d -ltiff -lpng -ljpeg -lz -lcompface -lXpm -lXmu -lXt -lXext -lX11 -lSM -lICE -ldb -lgdbm -lgdbm_compat -lgpm -lncurses -L/usr/lib -lesd -laudiofile -lm -lasound -lpq -lldap -llber -lm -lutil
/usr/X11R6/lib/ undefined reference to `gdbm_open'
/usr/X11R6/lib/ undefined reference to `gdbm_errno'
/usr/X11R6/lib/ undefined reference to `gdbm_close'
/usr/X11R6/lib/ undefined reference to `_gdbm_memory'
/usr/X11R6/lib/ undefined reference to `gdbm_firstkey'
/usr/X11R6/lib/ undefined reference to `gdbm_nextkey'
/usr/X11R6/lib/ undefined reference to `gdbm_fetch'
/usr/X11R6/lib/ undefined reference to `_gdbm_file'
/usr/X11R6/lib/ undefined reference to `_gdbm_fetch_val'
/usr/X11R6/lib/ undefined reference to `gdbm_delete'
/usr/X11R6/lib/ undefined reference to `gdbm_store'
collect2: ld returned 1 exit status
make[1]: *** [xemacs] Error 1
make[1]: Leaving directory `/tmp/..var/portage/xemacs-21.4.19-r4/work/xemacs-21.4.19/src'
make: *** [src] Error 2

taking --as-needed out of that makes it work, which I do not understand, as i thought the --as-needed failures were generally due to an incorrect order of operands. I tried playing with order of operands ( ie: switching placement of FILE.o and -lLIB instructions ) to no avail, so Im guessing theres some intrinsic weirdness in gdbm :/
Comment 3 Hans de Graaff gentoo-dev 2006-09-02 07:21:05 UTC
I've looked into this a bit more today and it seems to me that the culprit is actually libgdbm_compat, which is not properly linked against libgdbm. This should be fixed in gdbm.

Interestingly for me linking works fine, but I get an undefined symbol gdbm_errno when trying to run the resulting executable.
Comment 4 Hans de Graaff gentoo-dev 2006-09-03 01:21:34 UTC
Created attachment 95818 [details, diff]

This patch fixes the file to properly include gdbm when linking. This fixes problems with --as-needed for applications that want to link to gdbm_compat (like xemacs).

The patch needs to be added to the sys-libs/gdbm ebuild.
Comment 5 Xake 2006-10-25 05:08:18 UTC
Ran into this today so.. Status?
Comment 6 Hans de Graaff gentoo-dev 2006-10-25 05:26:35 UTC
It's not a problem in xemacs but rather in gdbm as mentioned in comment 4. It should probably be reassigned to the gdbm people, but I can't do this. 
Comment 7 Hans de Graaff gentoo-dev 2006-11-05 00:19:03 UTC
Reassigning this to base-system as this has to be fixed in gdbm, not in xemacs.
Comment 8 SpanKY gentoo-dev 2006-11-05 00:36:10 UTC
not exactly ... if you build statically, xemacs will still fall apart

it needs to be -lgdbm_compat -lgdbm
Comment 9 Hans de Graaff gentoo-dev 2006-12-10 03:42:24 UTC
This is now fixed in xemacs 21.4.19-r2. SpanKY, thanks for the feedback on how to deal with this properly.