Binutils compilation error /usr/lib/libiberty.a: error adding symbols: file format not recognized

Hi guys,

I'm trying to compile on archlinux master branch for R7800.
It looks like binutils is trying to link to my local machines /user/lib/libiberty.a file.

Any suggestions to correct this? Here is the full error output:


make[7]: Entering directory '/home/jman/src/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/binutils-2.37/libctf'
 /usr/bin/mkdir -p '/home/jman/src/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/binutils-2.37/ipkg-install/usr/lib'
 /bin/sh ./libtool   --mode=install /home/jman/src/openwrt/staging_dir/host/bin/install -c   libctf.la libctf-nobfd.la '/home/jman/src/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/binutils-2.37/ipkg-install/usr/lib'
libtool: install: warning: relinking `libctf.la'
libtool: install: (cd /home/jman/src/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/binutils-2.37/libctf; /bin/sh /home/jman/src/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/binutils-2.37/libctf/libtool  --tag CC --mode=relink arm-openwrt-linux-muslgnueabi-gcc -std=gnu99 -Wall -W -Wall -Wno-narrowing -Wwrite-strings -Wmissing-format-attribute -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -pedantic -Wno-long-long -I./../zlib -Os -pipe -g3 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -I/home/jman/src/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/lib/libiconv-stub/include -I/home/jman/src/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/lib/libintl-stub/include -fmacro-prefix-map=/home/jman/src/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/binutils-2.37=binutils-2.37 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DPIC -fpic -Wno-unused-value -version-info 0:0:0 -Wl,--version-script=./libctf.ver -L/home/jman/src/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-11.2.0_musl_eabi/usr/lib -L/home/jman/src/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-11.2.0_musl_eabi/lib -L/home/jman/src/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/lib/libiconv-stub/lib -Wl,-rpath-link=/home/jman/src/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/lib/libiconv-stub/lib -L/home/jman/src/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/lib/libintl-stub/lib -Wl,-rpath-link=/home/jman/src/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/lib/libintl-stub/lib -znow -zrelro -o libctf.la -rpath /usr/lib libctf_la-ctf-archive.lo libctf_la-ctf-dump.lo libctf_la-ctf-create.lo libctf_la-ctf-decl.lo libctf_la-ctf-error.lo libctf_la-ctf-hash.lo libctf_la-ctf-labels.lo libctf_la-ctf-dedup.lo libctf_la-ctf-link.lo libctf_la-ctf-lookup.lo libctf_la-ctf-open.lo libctf_la-ctf-serialize.lo libctf_la-ctf-sha1.lo libctf_la-ctf-string.lo libctf_la-ctf-subr.lo libctf_la-ctf-types.lo libctf_la-ctf-util.lo libctf_la-ctf-qsort_r.lo libctf_la-ctf-open-bfd.lo ../bfd/libbfd.la -L/home/jman/src/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/binutils-2.37/libctf/../libiberty/pic -liberty -L./../zlib -lz -inst-prefix-dir /home/jman/src/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/binutils-2.37/ipkg-install)
libtool: relink: arm-openwrt-linux-muslgnueabi-gcc -shared  -fPIC -DPIC  .libs/libctf_la-ctf-archive.o .libs/libctf_la-ctf-dump.o .libs/libctf_la-ctf-create.o .libs/libctf_la-ctf-decl.o .libs/libctf_la-ctf-error.o .libs/libctf_la-ctf-hash.o .libs/libctf_la-ctf-labels.o .libs/libctf_la-ctf-dedup.o .libs/libctf_la-ctf-link.o .libs/libctf_la-ctf-lookup.o .libs/libctf_la-ctf-open.o .libs/libctf_la-ctf-serialize.o .libs/libctf_la-ctf-sha1.o .libs/libctf_la-ctf-string.o .libs/libctf_la-ctf-subr.o .libs/libctf_la-ctf-types.o .libs/libctf_la-ctf-util.o .libs/libctf_la-ctf-qsort_r.o .libs/libctf_la-ctf-open-bfd.o   -L/home/jman/src/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-11.2.0_musl_eabi/usr/lib -L/home/jman/src/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-11.2.0_musl_eabi/lib -L/home/jman/src/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/lib/libiconv-stub/lib -L/home/jman/src/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/lib/libintl-stub/lib -L/home/jman/src/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/binutils-2.37/ipkg-install/usr/lib -L/usr/lib -lbfd -L/home/jman/src/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/binutils-2.37/bfd/../libiberty/pic -L/home/jman/src/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/binutils-2.37/zlib -L/home/jman/src/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/binutils-2.37/libctf/../libiberty/pic -liberty -lz  -mfloat-abi=hard -Wl,-z -Wl,now -Wl,-z -Wl,relro -Wl,--version-script=./libctf.ver -Wl,-rpath-link=/home/jman/src/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/lib/libiconv-stub/lib -Wl,-rpath-link=/home/jman/src/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/lib/libintl-stub/lib   -Wl,-soname -Wl,libctf.so.0 -o .libs/libctf.so.0.0.0
/home/jman/src/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-11.2.0_musl_eabi/lib/gcc/arm-openwrt-linux-muslgnueabi/11.2.0/../../../../arm-openwrt-linux-muslgnueabi/bin/ld: /usr/lib/libiberty.a: error adding symbols: file format not recognized
collect2: error: ld returned 1 exit status
libtool: install: error: relink `libctf.la' with the above command before installing it
make[7]: *** [Makefile:561: install-libLTLIBRARIES] Error 1
make[7]: Leaving directory '/home/jman/src/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/binutils-2.37/libctf'
make[6]: *** [Makefile:1245: install-am] Error 2
make[6]: Leaving directory '/home/jman/src/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/binutils-2.37/libctf'
make[5]: *** [Makefile:10547: install-libctf] Error 2
make[5]: Leaving directory '/home/jman/src/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/binutils-2.37'
make[4]: *** [Makefile:2339: install] Error 2
make[4]: Leaving directory '/home/jman/src/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/binutils-2.37'
make[3]: *** [Makefile:143: /home/jman/src/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/binutils-2.37/.built] Error 2
make[3]: Leaving directory '/home/jman/src/openwrt/package/devel/binutils'
time: package/devel/binutils/compile#1.68#0.47#2.09
    ERROR: package/devel/binutils failed to build.
make[2]: *** [package/Makefile:116: package/devel/binutils/compile] Error 1
make[2]: Leaving directory '/home/jman/src/openwrt'
make[1]: *** [package/Makefile:110: /home/jman/src/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/jman/src/openwrt'
make: *** [/home/jman/src/openwrt/include/toplevel.mk:230: world] Error 2

Full binutils output: https://pastebin.com/59Da3bhD

1 Like

do updatedb; locate target libiberty.a, add path to LDFLAGS in Makefile

Thanks for the suggestion, i tried it and it didn't work. For some reason the libtool relinker is putting "-L/usr/lib" on the path before it. I'm not sure where it's picking it up from.

https://sourceware.org/bugzilla/show_bug.cgi?id=28545

Having the same issue after binutils 2.37 update.
Had to go back to binutils 2.35.

The weird thing is, if i build it in ubuntu it build fine against 2.37, it's only in archlinux i'm having the issue.

I'm seeing this issue building mvebu on Arch. Going back to 2.35.2 didn't help.

I can build ath79, ramips/mt7621, mediatek/mt7622, lantiq and x86-64 just fine.

I was thinking it was my setup...

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.