Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 696106 - sci-libs/gdal-2.4.1 - ld: /usr/lib/ error adding symbols: file in wrong format
Summary: sci-libs/gdal-2.4.1 - ld: /usr/lib/ error adding symbols: file in w...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Sci-geo Project
: 701892 (view as bug list)
Depends on:
Blocks: no-symlink-lib
  Show dependency tree
Reported: 2019-10-03 07:50 UTC by Dhalsim
Modified: 2021-03-09 22:10 UTC (History)
4 users (show)

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

build log (first part) (xaa,878.91 KB, text/plain)
2019-10-03 09:22 UTC, Dhalsim
build log (second part) (xab,531.09 KB, text/plain)
2019-10-03 09:23 UTC, Dhalsim

Note You need to log in before you can comment on or make changes to this bug.
Description Dhalsim 2019-10-03 07:50:26 UTC
emerge --info:

Portage 2.3.76 (python 3.6.9-final-0, default/linux/amd64/17.1/desktop/plasma/systemd, gcc-8.3.0, glibc-2.29-r2, 4.19.72-gentoo x86_64)
System uname: Linux-4.19.72-gentoo-x86_64-Intel-R-_Core-TM-_i7-7700HQ_CPU_@_2.80GHz-with-gentoo-2.6
KiB Mem:    32802320 total,  24406012 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Thu, 03 Oct 2019 07:00:01 +0000
Head commit of repository gentoo: caaa892cef0b5975212c3ffe61ebaef71bb2b448
sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.31.1 p7) 2.31.1
app-shells/bash:          4.4_p23-r1::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.28.2-r1::gentoo
dev-lang/python:          2.7.16::gentoo, 3.6.9::gentoo
dev-util/cmake:           3.14.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.31.1-r6::gentoo, 2.32-r1::gentoo
sys-devel/gcc:            8.3.0-r1::gentoo
sys-devel/gcc-config:     2.0::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.19::gentoo (virtual/os-headers)
sys-libs/glibc:           2.29-r2::gentoo

    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://
    priority: -1000
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1

    location: /usr/local/portage
    masters: gentoo
    priority: 0

    location: /var/lib/layman/ace
    masters: gentoo
    priority: 50

    location: /var/lib/layman/audio-overlay
    masters: gentoo
    priority: 50

    location: /var/lib/layman/deadbeef-overlay
    masters: gentoo
    priority: 50

    location: /var/lib/layman/jorgicio
    masters: gentoo
    priority: 50

    location: /var/lib/layman/sage-on-gentoo
    masters: gentoo
    priority: 50

    location: /var/lib/layman/science
    masters: gentoo
    priority: 50

    location: /var/lib/layman/stefantalpalaru
    masters: gentoo
    priority: 50

    location: /var/lib/layman/torbrowser
    masters: gentoo
    priority: 50

    location: /var/lib/layman/vifino-overlay
    masters: gentoo
    priority: 50

Installed sets: @system
CFLAGS="-O2 -pipe -march=native"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.2/ext-active/ /etc/php/apache2-php7.3/ext-active/ /etc/php/cgi-php7.2/ext-active/ /etc/php/cgi-php7.3/ext-active/ /etc/php/cli-php7.2/ext-active/ /etc/php/cli-php7.3/ext-active/ /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 /etc/vmware-installer"
CXXFLAGS="-O2 -pipe -march=native"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="it en"
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"
USE="3dnow 7zip X a52 aac aalib accessibility acl acpi activities ada adabas addbookmarks addc addition additions ads afs aim aio akode alias alsa amd64 amr amrnb amrwb android ao apache2 apm apng applet archive arts artworkextra astribank atmo audiofile audioqueue autoipd automount autoreplace avi bash-completion battery bcmath beagle berkdb bidi big-tables binfilter birdstep bl bluetooth bluray bonjour bookmark-manager branding bs2b bzip2 c++ cairo calendar caps cdb cdda cddax cddb cdinstalla cdio cdparanoia cdr cgi chm cjk clang clearcase cli client cluster community compat connectionstatus contactnotes corba cpudetection cpufreq crypt css ctype cuda cups curl curlwrappers custom-cflags custom-cpuopts custom-cxxflags custom-optimization cvs cxx d daap dbase dbm dbmaker dbus dc1394 dconf decast declarative dedicated derby designer designer-plugin deskbar development device-mapper dga dhcpcd dirac divx djvu dmraid dmx dot dri dri3 dts dv dvb dvd dvdnav dvdr dvdread dvi dxva2 ecaggressive eckb1 ecmark ecmark2 ecmark3 ecmg2 ecsteve ecsteve2 eds egl emacs embed emboss emoticons-manager empress empress-bcs enca encode epiphany epoll esd esoob evdev evm examples exchange exif expat extensions extra extraengine extrafilters extras facebook fam fame farstream fbcon fdftk festival ffmpeg filebrowser filter firebird firefox firefox3 flac flatfile floppy florz fluidsynth flv fontconfig fortran fpx freetts frontbase ftp fts3 fuse fusion g3dvl gadu galago gd gdbm gdu gedit geolocation ggi gif gimp gimprint glade glamor gles gme gmedia gmp gnokii gnome gnome-keyring gnome-mmkeys gnutls gold gpg gphoto2 gpm gps graphite graphviz groupwise growl gs gsf gsm gstreamer gtk gtk2 gtk3 gtkhtml gzip gzip-el h323 hal hangouts haptic harfbuzz hash haskell hddtemp hdf5 hdri hidpi highlight history hotwording htmlhandbook http http-cache http2 httpd i18n ibmacpi iconv icu id3tag idn ieee1394 ifp ilbc imagemagick imap imlib infobar inifile inspector intl introspection iodbc ios-vout iplayer ipod ipv6 irc irda jabber jack jadetex java java6 javafx javascript jaz jbig jce jingle joystick jpeg jpeg2k json kate kde kdeenablefinal kdesu kdrive kig-scripting kipi kolab kpathsea krb4 kwallet ladspa lame lapack latex latin1 lcms ldap ldap-sasl legacy-systray libass libatomic libcaca libgcrypt libkms libnotify libproxy libsamplerate libsysfs libtar libtiger libtirpc libv4l2 lirc live lm_sensors logrotate lto lua lzma lzo mad matroska mbrola mcve md5sum mdnsresponder-compat meanwhile media-library mhash midi mikmod mime minizip mjpeg mmap mmxext mng mod modplug mongodb mono monolithic mozilla mp2 mp3 mp4 mpeg mpi mpris msn mssql mtp multilib multimedia musepack musical-spectrum musicbrainz mux mysql mysqli mythtv nas nautilus ncurses nemesi net netjack netmeeting network networkmanager nforce2 nis njb nls nntp nowlistening nptl numa nvtv objc objc++ objc-gc odk ogg oggvorbis omxil openal opencl opencv openexr opengl openmp openssl optimized-qmake opus oracle oralce7 oscar otr ovftool pam pango pascal passwdqc pbxt pch pcntl pcre pcre16 pda pdf pdfimport pdo perforce perl phonon php pic pkcs11 plasma playlist playtools plotutils plugins plymouth pmu png pnm policykit pop portaudio posix postgres postproc povray ppds pri printsupport profile profiling projectm pulseaudio pvr pyqt4 python qemu qml qq qt3 qt3support qt5 quick-search quicktime radio rar raw rdesktop rdp readline real realip realmedia realtime remote remoteosd replaygain-control reports resolvconf rfc3779 rtc rtlsdr rtsp ruby samba sametime sasl scanner schroedinger script sdl sdl-image sdlimage seamonkey seccomp secure-delete semantic-desktop server session sftp shine shout sid simplexml skins skype slp smartcard smi smp sms smtp sndfile snmp soap sockets socks5 solid solver soprano sound soundtouch source sox soxr spectrogram speex spell spice split-usr sql sqlite sqlite3 srt sse sse2 ssh ssl staging startup-notification static-libs statistics status statusnotifier stereo-widener stream sub subversion suid svc svg switcher sybase sybase-ct syslog system-wide systemd sysvipc szip t1lib taglib tcl tcpd teletext templates testbed texteffect tga theora threads tiff timidity tinfo tivo tk tools tordns tracker translator tremor truetype tslib twolame udev udisks unicode upcall upnp upnp-av upower usb usbredir user-session utils uvm v4l v4l2 vaapi vala vamp vcd vcdinfo vcdx vdpau vdr video videos virt-network visualization vix vk vlm vmware-tools vmware_guest_freebsd vmware_guest_linux vmware_guest_netware vmware_guest_solaris vmware_guest_winPre2k vmware_guest_windows vnc vorbis vpx vu-meter vulkan watchdog waveform-seekba wavpack wayland wayland-compositor wddx webdav webkit webpresence widgets wifi winbind winpopup wlm wma-fixed wmf wmp wxwidgets wxwindows x264 x265 xanim xattr xcb xcomposite xetex xfce xine xinerama xml xmlpatterns xmlreader xmlrpc xmlwriter xmp xosd xpm xsl xslt xtradb xulrunner xv xvid xvmc xwayland yahoo yaz zapnet zapras zeroconf zip zlib zoran zrtp zvbi" ABI_X86="32 64" ADA_TARGET="gnat_2018" 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="*" APACHE2_MPMS="event" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes mmx mmxext 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" INPUT_DEVICES="synaptics evdev" KERNEL="linux" L10N="it en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="*" NGINX_MODULES_HTTP="access addition auth_basic autoindex browser charset dav degradation empty_gif flv geo geoip gzip image_filter map memcached perl proxy random_index realip referer rewrite secure_link ssi stub_status sub upstream_ip_hash userid xslt" NGINX_MODULES_MAIL="imap pop3 smtp" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="intel i965 nvidia" 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"

partial build log:

make[1]: Entering directory '/var/tmp/portage/sci-libs/gdal-2.4.1/work/gdal-2.4.1'
/bin/sh /var/tmp/portage/sci-libs/gdal-2.4.1/work/gdal-2.4.1/libtool --mode=link --silent x86_64-pc-linux-gnu-g++ -Wl,-O1 -Wl,--as-needed  -lcrypto -lpoppler -ljson-c -L/usr//lib -L/usr/lib -lsqlite3 -lexpat -lopenjp2 -lhdf5 -lgif -ljpeg -lgeotiff -ltiff -lpng -L/usr/lib64/postgresql-10/lib64 -lpq -llzma -lz -L/usr/ -L/usr//lib -lpthread -lm -lrt -ldl  -lsqlite3 -lpcre   -lcurl -lnghttp2 -lidn2 -lssh2 -lssh2 -lssl3 -lsmime3 -lnss3 -lnssutil3 -lplds4 -lplc4 -lnspr4 -lldap -llber -lz        -lOpenCL    -lxml2 -lz -llzma -licui18n -licuuc -licudata -lm -ldl    -L/usr/lib64 -lmysqlclient  -lpthread -lz -lm -lrt -latomic -lssl -lcrypto -ldl   -o ./ogr/gml2ogrgeometry.lo ./ogr/ogr2gmlgeometry.lo 
    -rpath /usr/lib64 \
    -no-undefined \
    -version-info 25:1:5
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: skipping incompatible /usr//lib/ when searching for -ljson-c
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: skipping incompatible /usr//lib/libjson-c.a when searching for -ljson-c
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: skipping incompatible /usr/lib/ when searching for -ljson-c
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: skipping incompatible /usr/lib/libjson-c.a when searching for -ljson-c
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: skipping incompatible /usr//lib/ when searching for -lexpat
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: skipping incompatible /usr//lib/libexpat.a when searching for -lexpat
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: skipping incompatible /usr/lib/ when searching for -lexpat
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: skipping incompatible /usr/lib/libexpat.a when searching for -lexpat
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: skipping incompatible /usr//lib/ when searching for -lopenjp2
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: skipping incompatible /usr/lib/ when searching for -lopenjp2
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/ error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2019-10-03 08:25:06 UTC
(In reply to Dhalsim from comment #0)
> partial build log:

Please attach the entire build log to this bug report.
Comment 2 Dhalsim 2019-10-03 09:22:30 UTC
Created attachment 591674 [details]
build log (first part)

It seems that the issue is on link phase there when linking (see also it on the attachment):

/bin/sh /var/tmp/portage/sci-libs/gdal-2.4.1/work/gdal-2.4.1/libtool --mode=link --silent x86_64-pc-linux-gnu-g++ -Wl,-O1 -Wl,--as-needed  -lcrypto -lpoppler -ljson-c -L/usr//lib -L/usr/lib [...]

-L specify wrong lib dir. This went wrong since I switched to the newest 'no SYMLINK_LIB' 7.1 amd64 profile.
Comment 3 Dhalsim 2019-10-03 09:23:05 UTC
Created attachment 591676 [details]
build log (second part)
Comment 4 Dhalsim 2019-10-03 09:27:51 UTC
anyway the title of the bug should not refer specifically to

As reported in the partial build log ld tries to link all wrong 32bit libraries specified trough -l<commonlibname> parameter. (for example json-c, exapt ans so on)
Comment 5 Dhalsim 2019-10-09 08:04:58 UTC
I've tryed another AMD64 gentoo system and I have same issue.
Comment 6 cubus 2019-11-11 10:13:38 UTC
Same error emerging gdal 2.4.1 on my gentoo machine:
"/usr/lib/ error adding symbols: file in wrong format"

It seems like gdal custom libtool script tries to link a 32 bit lib.
I did the following steps to get past this:

# emerge gdal 

which will fail at above error then go to temp working dir:

# cd /var/tmp/portage/sci-libs/gdal-2.4.1/work/gdal-2.4.1

then edit file config.status changing the line that starts with
S["LIBS"]="-lcrypto ...
and contains references to wrong "usr//lib" (twice)
change them to "usr/lib64" (you can keep only one instance)
in my case diff look like this:

< S["LIBS"]="-lcrypto -ljson-c -L/usr//lib -lexpat -lopenjp2  -lgif -ljpeg -lgeotiff -ltiff -lpng -lz -L/usr/ -L/usr//lib  -lm -lrt -ldl  -lpcre"
> S["LIBS"]="-lcrypto -ljson-c -lexpat -lopenjp2  -lgif -ljpeg -lgeotiff -ltiff -lpng -lz -L/usr/ -L/usr/lib64  -lm -lrt -ldl  -lpcre"

after this resume with ebuild (because emerge will undo changes):

# ebuild /usr/portage/sci-libs/gdal/gdal-2.4.1.ebuild compile
# ebuild /usr/portage/sci-libs/gdal/gdal-2.4.1.ebuild install
# ebuild /usr/portage/sci-libs/gdal/gdal-2.4.1.ebuild qmerge

if you install a different version than 2.4.1 of gdal with same error then change all "2.4.1" from above to you version.
Comment 7 Alexander Tsoy 2019-12-03 17:05:57 UTC
This is probably due to [1], [2] and --with-libz="${EPREFIX}/usr/" --with-libjson-c="${EPREFIX}/usr/" in ebuild.

Comment 8 Andreas Sturmlechner gentoo-dev 2019-12-28 17:38:58 UTC
*** Bug 701892 has been marked as a duplicate of this bug. ***
Comment 9 Andreas Sturmlechner gentoo-dev 2020-04-13 09:29:20 UTC
Is it still a problem with 3.0.4-r1?
Comment 10 Dhalsim 2020-04-13 16:58:06 UTC
@Andreas,Hi, confirmed also with sci-libs/gdal-3.0.4-r1.

Still using cubus' edit and recompile workaround to merge.

Comment 11 Helmut Jarausch 2020-05-13 17:37:04 UTC
(In reply to Andreas Sturmlechner from comment #9)
> Is it still a problem with 3.0.4-r1?

thanks for reminding me,
Comment 12 Jakov Smolić gentoo-dev 2021-02-18 11:31:32 UTC
Fixed in later versions
Comment 13 Jakov Smolić gentoo-dev 2021-02-18 11:33:33 UTC
(In reply to Dhalsim from comment #10)
> @Andreas,Hi, confirmed also with sci-libs/gdal-3.0.4-r1.
> Still using cubus' edit and recompile workaround to merge.
> Reagrds.

Hmm, looks like it's not after all. Can you please test 3.2.1-r1?
Comment 14 Larry the Git Cow gentoo-dev 2021-03-09 20:43:36 UTC
The bug has been closed via the following commit(s):

commit a2df5bcead58163828cde20535e4b4f4204f4ecf
Author:     Sam James <>
AuthorDate: 2021-03-09 20:38:45 +0000
Commit:     Sam James <>
CommitDate: 2021-03-09 20:43:26 +0000

    sci-libs/gdal: respect libdir
    To be upstreamed.
    Unfortunately, we can't do *everything* required in Gentoo
    in the patch, as there's a --with-local argument which I'd
    prefer to get rid of, but is a bit too invasive of a change
    for me to want to push upstream for now.
    So, we settle on a single sed in the ebuild, which is an
    Signed-off-by: Sam James <>

 sci-libs/gdal/files/gdal-3.2.1-libdir.patch | 407 ++++++++++++++++++++++++++++
 sci-libs/gdal/gdal-3.2.1-r1.ebuild          |  11 +-
 2 files changed, 416 insertions(+), 2 deletions(-)
Comment 15 Larry the Git Cow gentoo-dev 2021-03-09 22:08:18 UTC
The bug has been referenced in the following commit(s):

commit d72b95c42efb6fa261ebe1849f298153c5dfc8a1
Author:     Sam James <>
AuthorDate: 2021-03-09 22:06:24 +0000
Commit:     Sam James <>
CommitDate: 2021-03-09 22:08:09 +0000

    sci-libs/gdal: add link to upstream PR
    Signed-off-by: Sam James <>

 sci-libs/gdal/files/gdal-3.2.1-libdir.patch | 2 ++
 1 file changed, 2 insertions(+)
Comment 16 Larry the Git Cow gentoo-dev 2021-03-09 22:10:31 UTC
The bug has been referenced in the following commit(s):

commit 871d75f47010b9efc658ea04690c18a837c67e1b
Author:     Sam James <>
AuthorDate: 2021-03-09 22:09:59 +0000
Commit:     Sam James <>
CommitDate: 2021-03-09 22:09:59 +0000

    sci-libs/gdal: update libdir patch slightly
    * Removed more obsolete libproj logic/checks
    * Fix json-c too
    Signed-off-by: Sam James <>

 sci-libs/gdal/files/gdal-3.2.1-libdir.patch | 166 ++++++++++++++++------------
 1 file changed, 95 insertions(+), 71 deletions(-)