Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 646380 - >=net-dns/bind-9.11.2_p1 - /usr/lib/libdb-5.3.so: error adding symbols: File in wrong format
Summary: >=net-dns/bind-9.11.2_p1 - /usr/lib/libdb-5.3.so: error adding symbols: File ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Christian Ruppert (idl0r)
URL:
Whiteboard:
Keywords:
: 691680 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-02-02 05:28 UTC by Leonid Kopylov
Modified: 2019-09-08 22:14 UTC (History)
4 users (show)

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


Attachments
build.log (build.log,875.17 KB, text/plain)
2018-02-02 05:28 UTC, Leonid Kopylov
Details
Patch for absolute -L/usr/lib path in dlz LDAP configure code (bind-9.12.3-symlink-lib-no-lib64-multilib.patch,3.08 KB, patch)
2019-06-19 06:34 UTC, Anon Emuss
Details | Diff
Add dependencies and configure patches to ebuild (bind-9.12.3_p4.ebuild.patch,884 bytes, patch)
2019-08-07 06:17 UTC, Anon Emuss
Details | Diff
Patch autotool macro to help find 64-bit OpenSSL library (bind-9.14.4-symlink-lib-no-lib64-openssl.patch,2.39 KB, patch)
2019-08-10 05:35 UTC, Anon Emuss
Details | Diff
Patch for bind-9.14.4.ebuild applying above patches (bind-9.14.4.ebuild.patch,1.99 KB, patch)
2019-08-10 05:42 UTC, Anon Emuss
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Leonid Kopylov 2018-02-02 05:28:35 UTC
# emerge --info '=net-dns/bind-9.11.2_p1::gentoo'
Portage 2.3.22 (python 3.5.4-final-0, default/linux/amd64/17.1/desktop/gnome/systemd, gcc-7.3.0, glibc-2.26-r5, 4.15.0-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.15.0-gentoo-x86_64-Intel-R-_Core-TM-_i7-6700_CPU_@_3.40GHz-with-gentoo-2.4.1
KiB Mem:     4042980 total,   1985760 free
KiB Swap:    4194300 total,   3742984 free
Timestamp of repository gentoo: Thu, 01 Feb 2018 10:00:02 +0000
Head commit of repository gentoo: 235c1ae4ecdbe33b7a34b768ea2248aa566cc303
sh bash 4.4_p12-r1
ld GNU ld (Gentoo 2.29.1 p3) 2.29.1
ccache version 3.3.4 [disabled]
app-shells/bash:          4.4_p12-r1::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.26.1-r1::gentoo
dev-lang/python:          2.7.14-r1::gentoo, 3.5.4-r1::gentoo, 3.6.4::gentoo
dev-util/ccache:          3.3.4-r1::gentoo
dev-util/cmake:           3.10.2::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/sandbox:         2.12::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.15.1-r1::gentoo
sys-devel/binutils:       2.29.1-r1::gentoo, 2.30::gentoo
sys-devel/gcc:            7.3.0::gentoo
sys-devel/gcc-config:     1.9.1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.15::gentoo (virtual/os-headers)
sys-libs/glibc:           2.26-r5::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts:
    sync-rsync-verify-metamanifest: yes

4nykey
    location: /var/lib/layman/4nykey
    sync-type: laymansync
    sync-uri: https://github.com/4nykey/4nykey.git
    masters: gentoo
    priority: 50

dotnet
    location: /var/lib/layman/dotnet
    sync-type: laymansync
    sync-uri: https://anongit.gentoo.org/git/proj/dotnet.git
    masters: gentoo
    priority: 50

gentoo-zh
    location: /var/lib/layman/gentoo-zh
    sync-type: laymansync
    sync-uri: git://github.com/microcai/gentoo-zh.git
    masters: gentoo
    priority: 50

jm-overlay
    location: /var/lib/layman/jm-overlay
    sync-type: laymansync
    sync-uri: https://github.com/Jannis234/jm-overlay.git
    masters: dotnet gentoo
    priority: 50

rion
    location: /var/lib/layman/rion
    sync-type: laymansync
    sync-uri: https://github.com/rion-overlay/rion-overlay.git
    masters: gentoo
    priority: 50

steam-overlay
    location: /var/lib/layman/steam-overlay
    sync-type: laymansync
    sync-uri: https://github.com/anyc/steam-overlay.git
    masters: gentoo
    priority: 50

wine
    location: /var/lib/layman/wine
    sync-type: laymansync
    sync-uri: https://anongit.gentoo.org/git/repo/proj/wine.git
    masters: gentoo
    priority: 50

Installed sets: @my-archives, @my-browsers, @my-cloud, @my-disk-utils, @my-docker, @my-editors, @my-hardware-utils, @my-im-voip, @my-kernel-tools, @my-log-monitor, @my-mail-clients, @my-media, @my-media-players, @my-media-tools, @my-net-analyzers, @my-net-tools, @my-portage-tools, @my-remote, @my-security, @my-servers, @my-system-tools, @my-text-browsers, @my-virt-utils, @my-virtualization
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA google-chrome EULA FraunhoferFDK Nero-EULA-US PUEL OPERA-2014 RAR TeamViewer"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/chromium/policies/managed/chrome-gnome-shell.json /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/opt/chrome/policies/managed/chrome-gnome-shell.json /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://mirror.isoc.org.il/pub/gentoo/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en he ru en_US he_IL ru_RU"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac aalib accessibility acl acpi addressbook afp airplay all_sfx alsa amd64 anacron aosd apcupsd archive aspell audit autofs avahi bat berkdb bidi bittorrent bluetooth bluray box branding btrfs bzip2 cairo ccache cdda cddb cdio cdparanoia cdr cgmanager chromium cli client clockdiff cmus colord conntrack contrast contrib cracklib creds crypt cryptsetup cscope cups curl cxx daap dbus designer device-mapper discid dlz dmi dnd dns dolphin dos drawing dri dropbox dts dvb dvd dvdr eds efi emacs emboss emoji encode epub equalizer evo examples exif expat experimental fam farstream fat fdk finger firefox firewalld flac flickr fontconfig fortran freeimage fribidi ftp fuse games gconf gd gdbm geoclue geoip geolocation geonames gif gimp git glamor gles glusterfs gme gnome gnome-keyring gnome-online-accounts gnuplot go google googledrive gpg gpm graph growl grub gssapi gstreamer gtk gtk3 gui handwriting hddtemp help highlight hotkeys html http httpd hunspell iconv icq icu id3tag idn introspection ios iostats ipod ipv6 irc iscsi iso itunes java jpeg jpeg2k kde kerberos lastfm lcms ldap legacy-systray libass libcaca libkms libmpdclient libmpv libnotify libsecret libssh libuv libvisual lj lkrn lm_sensors localstorage location logrotate lua lvm lxc mad man marble math mbox mdadm mdnsresponder-compat mediainfo mediaplayer mediawiki mediawiki-experimental messages metalink minizip mms mng moc modules mount mount-locking mp3 mp4 mpd mpeg mplayer mpx msn mtp mule multilib multimedia musepack mutt mysql nano-syntax nas natspec nautilus ncat ncurses ndiff net netgroups netlink network network-cron networkmanager nfs nftables nis nls notmuch nping nptl nscd nslint nsplugin ntfs offensive office ogg openexr opengl openmp openntpd orientation oscar otr pam pango parted pcap pcre pdf pdfimport perl phonon pidgin plasma playlist plugins png podcast policykit pop positioning postgres ppds prediction printsupport prison pulseaudio python qalculate qml qrcode qt3support qt5 quickstarter quota raw rdp readline recorder remote rpc rss samba sasl savedconfig scope script scripttools scrobbler sdl seccomp semantic-desktop sendto sensord sensors session share skins skydrive slp smi smime smp smtp sndfile sound soundcloud speech speedpitch speex spell spice spoof-source sqlite ssh sshdump ssl startup-notification stats steam subtitles sudo svg symlink sync-plugin-portage systemd systray taglib tcpd terminal tfshark tftpd theora threads thumbnail tiff timezone tk tools tracepath tracker trayicon truetype tty-helpers udev udisks uml undi unicode update-check update_drivedb upnp upnp-av upower usb usbredir user-session utils v4l vala vboxwebsrv vim vim-pager vim-syntax vimeo virt-network virtualbox vkontakte vlc vlm vmware vnc vorbis vte warmstarts wayland webcam webdav webkit webp webready webserver widgets wifi winbind wininst wireshark-plugins wps wxwidgets x264 xa xattr xcb xemacs xface xfs xine xinerama xkb xml xmms2 xmp xmpp xscreensaver xv xvid xvmc yahoo zenmap zeroconf zip zlib" ABI_X86="64 32" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd 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 cgi cgid 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" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="evdev" KERNEL="linux" L10N="en en-US he ru" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="nlpsolver scripting-beanshell wiki-publisher scripting-javascript" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" RUBY_TARGETS="ruby22 ruby23 ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="vmware" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

# emerge -pqv '=net-dns/bind-9.11.2_p1::gentoo'
[ebuild  N    ] net-dns/bind-9.11.2_p1  USE="berkdb caps dlz doc geoip gssapi idn ipv6 ldap nslint postgres python ssl threads xml zlib -dnstap -filter-aaaa -fixed-rrset -gost -json -libressl -lmdb -mysql -odbc -rpz (-seccomp) (-selinux) -sta
Comment 1 Leonid Kopylov 2018-02-02 05:28:56 UTC
Created attachment 517528 [details]
build.log
Comment 2 OKUMURA N. Shin-ya 2018-05-02 17:15:40 UTC
I got a similar error with net-dns/bind-9.12.1.
It seems that libtool want to link amd64 binaries with /usr/lib/libdb-5.3.so, but not /usr/lib64/lib-5.3.so.
Probably configure scripts of net-dns/bind would be incorrect but not sure.
Comment 3 Kobboi 2018-08-22 18:19:46 UTC
I currently have bind always linking to libdb-5.3.so, leading to

!!! existing preserved libs:
>>> package: sys-libs/db-5.3.28-r3
 *  - /usr/lib64/libdb-5.3.so
 *      used by /usr/sbin/named (net-dns/bind-9.12.2_p1)

but no @revdep-rebuild ever fixes this.
Comment 4 Kobboi 2018-08-22 19:00:17 UTC
named seems to link against libdb-5.3.so but there is no such dependency specified in (R)DEPEND

$ objdump -x /usr/sbin/named

/usr/sbin/named:     file format elf64-x86-64
/usr/sbin/named
architecture: i386:x86-64, flags 0x00000150:
HAS_SYMS, DYNAMIC, D_PAGED
start address 0x00000000000221f0

Program Header:
    PHDR off    0x0000000000000040 vaddr 0x0000000000000040 paddr 0x0000000000000040 align 2**3
         filesz 0x0000000000000268 memsz 0x0000000000000268 flags r--
  INTERP off    0x00000000000002a8 vaddr 0x00000000000002a8 paddr 0x00000000000002a8 align 2**0
         filesz 0x000000000000001c memsz 0x000000000000001c flags r--
    LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**12
         filesz 0x0000000000011a20 memsz 0x0000000000011a20 flags r--
    LOAD off    0x0000000000012000 vaddr 0x0000000000012000 paddr 0x0000000000012000 align 2**12
         filesz 0x000000000004a18d memsz 0x000000000004a18d flags r-x
    LOAD off    0x000000000005d000 vaddr 0x000000000005d000 paddr 0x000000000005d000 align 2**12
         filesz 0x0000000000015f50 memsz 0x0000000000015f50 flags r--
    LOAD off    0x0000000000073ad0 vaddr 0x0000000000074ad0 paddr 0x0000000000074ad0 align 2**12
         filesz 0x000000000000b600 memsz 0x0000000000011d50 flags rw-
 DYNAMIC off    0x0000000000073b70 vaddr 0x0000000000074b70 paddr 0x0000000000074b70 align 2**3
         filesz 0x00000000000002c0 memsz 0x00000000000002c0 flags rw-
    NOTE off    0x00000000000002c4 vaddr 0x00000000000002c4 paddr 0x00000000000002c4 align 2**2
         filesz 0x0000000000000020 memsz 0x0000000000000020 flags r--
EH_FRAME off    0x000000000006cd08 vaddr 0x000000000006cd08 paddr 0x000000000006cd08 align 2**2
         filesz 0x0000000000000a6c memsz 0x0000000000000a6c flags r--
   STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**4
         filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
   RELRO off    0x0000000000073ad0 vaddr 0x0000000000074ad0 paddr 0x0000000000074ad0 align 2**0
         filesz 0x0000000000000530 memsz 0x0000000000000530 flags r--

Dynamic Section:
  NEEDED               libns.so.1203
  NEEDED               libdns.so.1205
  NEEDED               libbind9.so.1200
  NEEDED               libisccfg.so.1200
  NEEDED               libisccc.so.1200
  NEEDED               libisc.so.1200
  NEEDED               libcrypto.so.1.0.0
  NEEDED               libdb-5.3.so
  NEEDED               libldap-2.4.so.2
  NEEDED               libcap.so.2
  NEEDED               libpthread.so.0
  NEEDED               libxml2.so.2
  NEEDED               libz.so.1
  NEEDED               libdl.so.2
  NEEDED               libc.so.6
  INIT                 0x0000000000012000
  FINI                 0x000000000005c184
  INIT_ARRAY           0x0000000000074ad0
  INIT_ARRAYSZ         0x0000000000000008
  FINI_ARRAY           0x0000000000074ad8
  FINI_ARRAYSZ         0x0000000000000008
  GNU_HASH             0x00000000000002e8
  STRTAB               0x0000000000005ce0
  SYMTAB               0x00000000000003b8
  STRSZ                0x00000000000046ed
  SYMENT               0x0000000000000018
  DEBUG                0x0000000000000000
  PLTGOT               0x0000000000075000
  PLTRELSZ             0x0000000000005358
  PLTREL               0x0000000000000007
  JMPREL               0x000000000000c6c8
  RELA                 0x000000000000ac40
  RELASZ               0x0000000000001a88
  RELAENT              0x0000000000000018
  FLAGS_1              0x0000000008000000
  VERNEED              0x000000000000ab40
  VERNEEDNUM           0x0000000000000005
  VERSYM               0x000000000000a3ce
  RELACOUNT            0x00000000000000e3
Comment 5 Kobboi 2018-08-22 19:03:47 UTC
These are the versions of db that I have currently installed (4.8.30-r2 and 6.0.35-r1)

$ eix -e db
[I] sys-libs/db
     Available versions:  
     (1)    1.85-r3
     (3)    3.2.9_p2
     (4.2)  4.2.52_p5-r1
     (4.3)  4.3.29_p1-r1
     (4.4)  (~)4.4.20_p4-r1
     (4.5)  4.5.20_p2-r1
     (4.6)  4.6.21_p4
     (4.7)  4.7.25_p4
     (4.8)  4.8.30-r2{tbz2}
     (5.1)  (~)5.1.29-r1
     (5.3)  5.3.28-r2 (~)5.3.28-r3
     (6.0)  (~)6.0.35 (~)6.0.35-r1{tbz2}
     (6.1)  [M](~)6.1.29 [M](~)6.1.29-r1
     (6.2)  [M](~)6.2.23 [M](~)6.2.23-r1 [M](~)6.2.32 [M](~)6.2.32-r1
       {cxx doc examples java rpc tcl test ABI_MIPS="n32 n64 o32" ABI_PPC="32 64" ABI_S390="32 64" ABI_X86="32 64 x32" ELIBC="FreeBSD"}
     Installed versions:  4.8.30-r2(4.8){tbz2}(20:38:49 29/07/18)(cxx -doc -examples -java -tcl -test ABI_MIPS="-n32 -n64 -o32" ABI_PPC="-32 -64" ABI_S390="-32 -64" ABI_X86="32 64 -x32" ELIBC="-FreeBSD") 6.0.35-r1(6.0){tbz2}(20:34:52 29/07/18)(cxx -doc -examples -java -tcl -test ABI_MIPS="-n32 -n64 -o32" ABI_PPC="-32 -64" ABI_S390="-32 -64" ABI_X86="32 64 -x32" ELIBC="-FreeBSD")
     Homepage:            http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/overview/index.html
     Description:         Oracle Berkeley DB
Comment 6 Anon Emuss 2019-06-19 06:27:15 UTC
I am having a similar problem (wrong file type for libdb-5.3.so).  I can work around it by emerging with the following USE flags (it fails if the ldap USE flag set):
  berkdb caps dlz doc ipv6 python ssl threads xml zlib
  -dnsrps -dnstap -fixed-rrset -geoip -gost -gssapi -json -ldap -libressl -lmdb -mysql -odbc -postgres -rpz -seccomp -selinux -static-libs -urandom
I was able to develop a patch that fixes the LDAP problem for me.  It is a
bit of a hack because I am not very familiar with autoconf, and it appears
that bind is pretty out-of-date with that, too.  I will try to add my patch
shortly.

Here is how the problem occurs on my system:

Package with relevant USE flags:  net-dns/bind-9.12.3_p4 +berkdb +dlz +ldap
I recently switched to profile 17.1, so SYMLINK_LIB is now set to 'no'.  For me, the bug is triggered by having 32-bit libraries in /usr/lib/, and 64-bit libraries in /usr/lib64/ (plus the combination of relevant USE flags mentioned above).

If the dlz and ldap USE flags are enabled, then the bind configure script will search for the LDAP libraries in the directories specified at contrib/dlz/contrib.dlz.in:374.  /usr is in the list, and it appends /lib to that, not /lib64.  It adds the -L/usr/lib to the library list.  The libtool script has code that searches for libtool libraries using a search path that includes any paths specified with -L.  If it finds a -l flag pointing at a libtool library, it replaces the -l flag with an absolute path to the library.  When parsing the -ldb flag (resulting from the +berkdb USE flag), it finds /usr/lib/libdb-5.3.la.  Using that, it replaces -ldb with /usr/lib/libdb-5.3.so.  This is the 32-bit library; the 64-bit library is /usr/lib64/libdb-5.3.so.  Having -L/usr/lib in the search path is what produces the ``skipping incompatible /usr/lib/*.so when searching for -l*''-type warnings seen in Leonid Kopylov's build log, but it is the one libtool-ized library, libdb, that has the full path specified as a result and so that is the one that triggers the wrong-format error.

On my system, compiling with USE=-ldap works, but USE=ldap fails.  Scanning
through contrib/dlz/contrib.dlz.in, it looks like various other USE flags
(postgres, mysql, and odbc) have other tests that will not add -L/usr/lib under normal circumstances and so, I think, will not trigger the problem.
Comment 7 Anon Emuss 2019-06-19 06:34:56 UTC
Created attachment 580148 [details, diff]
Patch for absolute -L/usr/lib path in dlz LDAP configure code

As described above, when compiling with 32-bit libraries in /usr/lib/ and 64-bit libraries in /usr/lib64/ and USE='+berkdb +dlz +ldap', the configure script searches a hardcoded /usr/lib/ for an LDAP library, finds it, and adds -L/usr/lib to the linker flags.  This causes libtool to find /usr/lib/libdb-5.3.la and end up replacing -ldb with /usr/lib/libdb-5.3.so in the linker command, which is a 32-bit library.  If the build is 64-bit, this fails.

This patch attempts to fix the issue by adding some extra code to the configure tests trying to find the LDAP library, using some of the searches for other libraries (specifically, libdb) as a template.  The library search is similar, but it first just tries -lldap to see if that works (the configure script should already be passed --with-libs=/usr/lib64, so that path should be searched).  If that works, then the linker will simply be passed -lldap without any -L flags that could mislead the libtool script.
Comment 8 Jim Burwell 2019-07-17 05:55:10 UTC
I can confirm similar behavior.  I just upgraded profile from 17.0 to 17.1 and after this BIND won't compile with the same issues, trying to link to the wrong library.
Comment 9 Tanktalus 2019-08-05 19:11:48 UTC
Similar problem here, but the complaining library is libcrypto instead of libdb. See https://forums.gentoo.org/viewtopic-t-1100294.html for my details.
Comment 10 Anon Emuss 2019-08-07 06:17:34 UTC
Created attachment 585962 [details, diff]
Add dependencies and configure patches to ebuild

I agree with Kobboi (comment #4).  The configure scripts link to libdb when --with-dlz-bdb is enabled, which happens with the berkdb USE flag is specified.  I think the following atom should be added to the DEPEND variable in the ebuild:
  berkdb? ( sys-libs/db )
I am attaching the patch for the ebuild that I am currently using, in case it helps somebody (it references the configure patch I added earlier).
Comment 11 Anon Emuss 2019-08-10 05:35:08 UTC
Created attachment 586404 [details, diff]
Patch autotool macro to help find 64-bit OpenSSL library

net-dns/bind-9.14.4 appears to have some extra macros with hardcoded paths.  These can trigger the same bug where they specify -L/usr/lib on the linker line, causing the libtool script to search that path for libtool files.  If linking with libdb, which may have such a libtool file, the libtool script replaces -ldb with the path to libdb in /usr/lib.  If that is a 32-bit library on a 64-bit build, this causes linking to fail.  The -L/usr/lib also causes warnings about skipping 32-bit libraries for other libraries.

I am attaching a patch that helps circumvent that by copying a block that uses pkg-config to find the library where it can, bypassing the hardcoded paths and the addition of a -L flag.  I am not familiar enough with autotools to know what a more permanent fix would look like, but it seems unlikely that simply modifying the hardcoded search path is the way to go.
Comment 12 Anon Emuss 2019-08-10 05:42:47 UTC
Created attachment 586406 [details, diff]
Patch for bind-9.14.4.ebuild applying above patches

The two fixes developed for net-dns/bind-9.12.3 appear to still be applicable to net-dns/bind-9.14.4.  This patch modifies the net-dns/bind-9.14.4 ebuild script to include sys-libs/db in the DEPEND variable when emerging with USE=berkdb, and applies the dlz configure script patches to work around the hardcoded paths that tend to point at 32-bit libraries on SYMLINK_LIB=no multilib systems.

This patch also applies a second patch for an autotool macro that was not present in net-dns/bind-9.12.3, also attempting to bypass hardcoded paths that sometimes point to 32-bit libraries in a 64-bit build.

Finally, the patch removes specifying a particular OpenSSL root path to the configure script.  This is to prevent it from conflicting with the second patch that uses pkg-config to find the library, but I am worried I am reverting some change that was introduced to fix some other bug.  If this breaks something for somebody, I would appreciate hearing about it.
Comment 13 Mikle Kolyada archtester Gentoo Infrastructure gentoo-dev Security 2019-08-18 20:02:11 UTC
*** Bug 691680 has been marked as a duplicate of this bug. ***
Comment 14 Mikle Kolyada archtester Gentoo Infrastructure gentoo-dev Security 2019-08-18 20:09:32 UTC
Yaking into account number of hardcoded libdirs I guess something like

`export LDFLAGS="${LDFLAGS} -L${EPREFIX}/usr/$(get_libsir)"` must work, if something does not happen automagically.
Comment 15 Mikle Kolyada archtester Gentoo Infrastructure gentoo-dev Security 2019-08-18 22:34:32 UTC
(In reply to Mikle Kolyada from comment #14)
> Yaking into account number of hardcoded libdirs I guess something like
> 
> `export LDFLAGS="${LDFLAGS} -L${EPREFIX}/usr/$(get_libsir)"` must work, if
> something does not happen automagically.

Commited. Lets see if this is enough.
Comment 16 Anon Emuss 2019-09-08 22:14:54 UTC
(In reply to Mikle Kolyada from comment #15)
> (In reply to Mikle Kolyada from comment #14)
> > Yaking into account number of hardcoded libdirs I guess something like
> > 
> > `export LDFLAGS="${LDFLAGS} -L${EPREFIX}/usr/$(get_libsir)"` must work, if
> > something does not happen automagically.
> 
> Commited. Lets see if this is enough.

Sorry for the delay.  I have been unavailable for a while.

This appears to work for me.  My bind-9.14.4 has my patch included, which works.  I tried installing bind-9.14.5 (which does not have my patch, but is currently marked unstable) as-is, and that succeeded.  I tried removing the LDFLAGS line mentioned above from bind-9.14.5.ebuild, and the compile failed with the usual error (``error adding symbols: File in wrong format.'').  This suggests that that one line does fix the problem.

I compared logs, and the LDFLAGS line also gets rid of the ``skipping incompatible ...'' warnings.  I was skeptical that this would work since a script is manually inserting the wrong path to the libdb library, but it does so by searching the -L directories.  The configure script and its hardcoded paths is still adding the incorrect -L/usr/lib, but with the LDFLAGS line in the ebuild, the command has the correct -L/usr/lib64 BEFORE the incorrect -L/usr/lib, so the script sets the correct libdb path.  Despite the incorrect -L on the command line, I think this LDFLAGS fix is cleaner and more generally applicable than my patch.

Thanks.