<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>143580</bug_id>
          
          <creation_ts>2006-08-11 08:29 0000</creation_ts>
          <short_desc>sys-libs/gdbm patch for use with --as-needed</short_desc>
          <delta_ts>2006-12-10 03:42:24 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Ebuilds</component>
          <version>2006.0</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>129413</blocked>
          
          <everconfirmed>1</everconfirmed>
          <reporter>gentoo@torangan.de</reporter>
          <assigned_to>xemacs@gentoo.org</assigned_to>
          <cc>flameeyes@gentoo.org</cc>
    
    <cc>graaff@gentoo.org</cc>
    
    <cc>kentfredric@gmail.com</cc>
    
    <cc>xake@rymdraket.net</cc>

      

      
          <long_desc isprivate="0">
            <who>gentoo@torangan.de</who>
            <bug_when>2006-08-11 08:29:11 0000</bug_when>
            <thetext>When using this flag configure failed on &quot;checking for dbm_open in -lgdbm_compat using extra libs -lgdbm...&quot;. 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&apos;s obvious that it&apos;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-apps/sandbox:    1.2.18.1
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=&quot;amd64 ~amd64&quot;
AUTOCLEAN=&quot;yes&quot;
CBUILD=&quot;x86_64-pc-linux-gnu&quot;
CFLAGS=&quot;-march=k8 -O3 -msse3 -ftree-vectorize&quot;
CHOST=&quot;x86_64-pc-linux-gnu&quot;
CONFIG_PROTECT=&quot;/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&quot;
CONFIG_PROTECT_MASK=&quot;/etc/env.d /etc/eselect/compiler /etc/gconf /etc/revdep-rebuild /etc/terminfo&quot;
CXXFLAGS=&quot;-march=k8 -O3 -msse3 -fvisibility-inlines-hidden -ftree-vectorize&quot;
DISTDIR=&quot;/usr/portage/distfiles&quot;
FEATURES=&quot;autoconfig ccache distlocks metadata-transfer parallel-fetch sandbox sfperms strict&quot;
GENTOO_MIRRORS=&quot;ftp://ftp.tu-clausthal.de/pub/linux/gentoo http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo&quot;
LANG=&quot;de_DE@euro&quot;
LC_ALL=&quot;de_DE@euro&quot;
LDFLAGS=&quot;-Wl,-O1 -Wl,--sort-common -Wl,--as-needed&quot;
LINGUAS=&quot;de&quot;
MAKEOPTS=&quot;-j2&quot;
PKGDIR=&quot;/usr/portage/packages&quot;
PORTAGE_RSYNC_OPTS=&quot;--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=&apos;/distfiles&apos; --exclude=&apos;/local&apos; --exclude=&apos;/packages&apos;&quot;
PORTAGE_TMPDIR=&quot;/var/tmp&quot;
PORTDIR=&quot;/usr/portage&quot;
PORTDIR_OVERLAY=&quot;/usr/local/portage&quot;
SYNC=&quot;rsync://rsync.europe.gentoo.org/gentoo-portage&quot;
USE=&quot;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&quot;
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_RSYNC_EXTRA_OPTS</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>graaff@gentoo.org</who>
            <bug_when>2006-08-13 02:16:49 0000</bug_when>
            <thetext>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: http://moving-innovations.com/svn/xemacs/ 
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=&quot;gdbm berkdb&quot; LDFLAGS=&quot;-Wl,--as-needed&quot; emerge xemacs

Hopefully this version of the ebuild will be in portage soon as I am currently on track to become a developer.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>kentfredric@gmail.com</who>
            <bug_when>2006-08-27 11:44:40 0000</bug_when>
            <thetext>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/libgdbm_compat.so: undefined reference to `gdbm_open&apos;
/usr/X11R6/lib/libgdbm_compat.so: undefined reference to `gdbm_errno&apos;
/usr/X11R6/lib/libgdbm_compat.so: undefined reference to `gdbm_close&apos;
/usr/X11R6/lib/libgdbm_compat.so: undefined reference to `_gdbm_memory&apos;
/usr/X11R6/lib/libgdbm_compat.so: undefined reference to `gdbm_firstkey&apos;
/usr/X11R6/lib/libgdbm_compat.so: undefined reference to `gdbm_nextkey&apos;
/usr/X11R6/lib/libgdbm_compat.so: undefined reference to `gdbm_fetch&apos;
/usr/X11R6/lib/libgdbm_compat.so: undefined reference to `_gdbm_file&apos;
/usr/X11R6/lib/libgdbm_compat.so: undefined reference to `_gdbm_fetch_val&apos;
/usr/X11R6/lib/libgdbm_compat.so: undefined reference to `gdbm_delete&apos;
/usr/X11R6/lib/libgdbm_compat.so: undefined reference to `gdbm_store&apos;
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&apos;
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 :/
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>graaff@gentoo.org</who>
            <bug_when>2006-09-02 07:21:05 0000</bug_when>
            <thetext>I&apos;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.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>graaff@gentoo.org</who>
            <bug_when>2006-09-03 01:21:34 0000</bug_when>
            <thetext>Created an attachment (id=95818)
gdbm-1.8.3-as-needed.patch

This patch fixes the gdbm_compat.la 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.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>xake@rymdraket.net</who>
            <bug_when>2006-10-25 05:08:18 0000</bug_when>
            <thetext>Ran into this today so.. Status?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>graaff@gentoo.org</who>
            <bug_when>2006-10-25 05:26:35 0000</bug_when>
            <thetext>It&apos;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&apos;t do this. </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>graaff@gentoo.org</who>
            <bug_when>2006-11-05 00:19:03 0000</bug_when>
            <thetext>Reassigning this to base-system as this has to be fixed in gdbm, not in xemacs.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vapier@gentoo.org</who>
            <bug_when>2006-11-05 00:36:10 0000</bug_when>
            <thetext>not exactly ... if you build statically, xemacs will still fall apart

it needs to be -lgdbm_compat -lgdbm</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>graaff@gentoo.org</who>
            <bug_when>2006-12-10 03:42:24 0000</bug_when>
            <thetext>This is now fixed in xemacs 21.4.19-r2. SpanKY, thanks for the feedback on how to deal with this properly.</thetext>
          </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>95818</attachid>
            <date>2006-09-03 01:21 0000</date>
            <desc>gdbm-1.8.3-as-needed.patch</desc>
            <filename>gdbm-1.8.3-as-needed.patch</filename>
            <type>text/plain</type>
            <data encoding="base64">IEluY2x1ZGUgZ2RibSBsaWJyYXJ5IGluIGdkYm1fY29tcGF0IGxpbmtlciBmaWxlIHRvIGZpeCBw
cm9ibGVtcyB3aXRoCiAtLWFzLW5lZWRlZC4gQnVnIDE0MzU4MAoKLS0tIE1ha2VmaWxlLmluCisr
KyBNYWtlZmlsZS5pbgpAQCAtMTYxLDcgKzE2MSw3IEBACiBsaWJnZGJtX2NvbXBhdC5sYTogJChD
X0xPQkpTKSBnZGJtLmgKIAlybSAtZiBsaWJnZGJtX2NvbXBhdC5sYQogCSQoTElCVE9PTCkgLS1t
b2RlPWxpbmsgJChDQykgLW8gbGliZ2RibV9jb21wYXQubGEgLXJwYXRoICQobGliZGlyKSBcCi0J
CS12ZXJzaW9uLWluZm8gJChTSExJQl9WRVIpICQoQ19MT0JKUykKKwkJLXZlcnNpb24taW5mbyAk
KFNITElCX1ZFUikgJChDX0xPQkpTKSAtbGdkYm0KIAogZ2RibS5oOglnZGJtLnByb3RvIGdkYm1l
cnJuby5oIGdkYm0ucHJvdG8yCiAJcm0gLWYgZ2RibS5oCg==
</data>        

          </attachment>
    </bug>

</bugzilla>