OpenWrt Firmware building / Compiling: Linking Error:

I am building for my LinkSysWRT3200ACM, snapshot latest release or even latest master release.
and everything goes well up to this:

libtool: warning: relinking 'libdns_sd.la'
libtool: install: (cd /home/eliminater74/Builds/openwrt/openwrt-git4-test/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/avahi-dbus/avahi-0.8/avahi-compat-libdns_sd; /bin/sh "/home/eliminater74/Builds/openwrt/openwrt-git4-test/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/avahi-dbus/avahi-0.8/libtool"  --tag CC --mode=relink arm-openwrt-linux-muslgnueabi-gcc -I.. "-DDEBUG_TRAP=__asm__(\"int \$3\")" -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -fmacro-prefix-map=/home/eliminater74/Builds/openwrt/openwrt-git4-test/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/avahi-dbus/avahi-0.8=avahi-0.8 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -fpic -DGETTEXT_PACKAGE -DNDEBUG -DDISABLE_SYSTEMD -fstack-protector -std=c99 -Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -fdiagnostics-show-option -Wno-cast-qual -fno-strict-aliasing -version-info 1:0:0 ../avahi-common/libavahi-common.la ../avahi-client/libavahi-client.la -L/home/eliminater74/Builds/openwrt/openwrt-git4-test/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/usr/lib -L/home/eliminater74/Builds/openwrt/openwrt-git4-test/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/lib -L/home/eliminater74/Builds/openwrt/openwrt-git4-test/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-9.3.0_musl_eabi/usr/lib -L/home/eliminater74/Builds/openwrt/openwrt-git4-test/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-9.3.0_musl_eabi/lib -znow -zrelro -o libdns_sd.la -rpath /usr/lib libdns_sd_la-compat.lo libdns_sd_la-txt.lo libdns_sd_la-unsupported.lo libdns_sd_la-warn.lo -inst-prefix-dir /home/eliminater74/Builds/openwrt/openwrt-git4-test/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/avahi-dbus/avahi-0.8/ipkg-install)
libtool: relink: arm-openwrt-linux-muslgnueabi-gcc -shared  -fPIC -DPIC  .libs/libdns_sd_la-compat.o .libs/libdns_sd_la-txt.o .libs/libdns_sd_la-unsupported.o .libs/libdns_sd_la-warn.o   -L/home/eliminater74/Builds/openwrt/openwrt-git4-test/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/avahi-dbus/avahi-0.8/ipkg-install/usr/lib -L/usr/lib -lavahi-common -lavahi-client -L/home/eliminater74/Builds/openwrt/openwrt-git4-test/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/usr/lib -L/home/eliminater74/Builds/openwrt/openwrt-git4-test/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/lib -L/home/eliminater74/Builds/openwrt/openwrt-git4-test/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-9.3.0_musl_eabi/usr/lib -L/home/eliminater74/Builds/openwrt/openwrt-git4-test/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-9.3.0_musl_eabi/lib  -Os -mfloat-abi=hard -fstack-protector -Wl,-z -Wl,now -Wl,-z -Wl,relro -fstack-protector   -Wl,-soname -Wl,libdns_sd.so.1 -o .libs/libdns_sd.so.1.0.0
/usr/lib/libgcc_s.so.1: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
libtool:   error: error: relink 'libdns_sd.la' with the above command before installing it
make[6]: *** [Makefile:597: install-libLTLIBRARIES] Error 1
make[6]: Leaving directory '/home/eliminater74/Builds/openwrt/openwrt-git4-test/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/avahi-dbus/avahi-0.8/avahi-compat-libdns_sd'
make[5]: *** [Makefile:922: install-am] Error 2
make[5]: Leaving directory '/home/eliminater74/Builds/openwrt/openwrt-git4-test/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/avahi-dbus/avahi-0.8/avahi-compat-libdns_sd'
make[4]: *** [Makefile:825: install-recursive] Error 1
make[4]: Leaving directory '/home/eliminater74/Builds/openwrt/openwrt-git4-test/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/avahi-dbus/avahi-0.8'
make[3]: *** [Makefile:399: /home/eliminater74/Builds/openwrt/openwrt-git4-test/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/avahi-dbus/avahi-0.8/.built] Error 2
make[3]: Leaving directory '/home/eliminater74/Builds/openwrt/openwrt-git4-test/feeds/packages/libs/avahi'
time: package/feeds/packages/avahi/dbus/compile#29.18#6.17#32.45
make[2]: *** [package/Makefile:113: package/feeds/packages/avahi/compile] Error 2
make[2]: Leaving directory '/home/eliminater74/Builds/openwrt/openwrt-git4-test'
make[1]: *** [package/Makefile:107: /home/eliminater74/Builds/openwrt/openwrt-git4-test/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/eliminater74/Builds/openwrt/openwrt-git4-test'
make: *** [/home/eliminater74/Builds/openwrt/openwrt-git4-test/include/toplevel.mk:236: world] Error 2

I dont get this error, I have tried looking it up, but nothing comes up, all I can seem to find is the
fact its trying to link with /usr of host system, which is running GCC 10.2....

My system is Pure Vanilla Arch Linux on i7 Sandybridge with 28GB of ram.
and around 10TB of Storage.. split between a few different Drives. Main Linus is a
500GB SSD...

Does anyone have a clue as to what I am doing wrong, or what I might need to do..

Thanks in advance for any help..

EDIT: Main focus error:

/usr/lib/libgcc_s.so.1: file not recognized: file format not recognized

Might be related to Arch Linux...

Search the forum and you find e.g.

One thing might also be "too new" gcc in your host.

Ps.
And are you using the default gcc version in OpenWrt buildroot, or have you configured it to use the newest version? Possibly all packages are not yet compatible with gcc 10.

1 Like

Default GCC was set to 8.x, I think I tried the 9.x, and errors came up.. so left it default..
I know I can get it to work by leaving out the package, but some other packages depend on that one.
so I am trying to figure out the deal.. and my system does run gcc 10.x and I have 9.x and 8.x installed as well. but the 10.x is the one that it sees.. and your right. its most likely because im running arch.. but I was hoping maybe something I can do, that would at least fix this. like throw it some command to use that would get it though this section. for the most part.. it compiles everything else just fine.....

and I have no problem running ImageBuilder.. and I have also compiled more stock related firmware with no problems.. but when I wanna custom it a bit more, by adding some more packages, is when I run into issues............

But thanks for your help.........

It is quite possible that there is bug in that package (libdns ?), so that it tries to use some host tool/lib instead of the toolchain/target lib. And for some reason that manifests with Arch Linux.

You might try running Ubuntu in Virtualbox and test wit the same config if that works there.

Hi, I'm also having this issue.

Compiling gnutls or libupnp under Arch Linux rolling release also fails with the same error. A temporal workaround is to remove all the files in the host compiling system on which Openwrt throws the error:

/usr/lib/libXXXX: file not recognized: file format not recognized

e.g in my case

mv /usr/lib/libnettle.so /usr/lib/libnettle.so.bak
mv /usr/lib/libhogweed.so /usr/lib/libhogweed.so.bak
mv /usr/lib/libgmp.so /usr/lib/libgmp.so.bak

Compile gnutls
make package/feeds/packages/gnutls/compile V=s

And restore again my host system files

mv /usr/lib/libnettle.so.bak /usr/lib/libnettle.so
mv /usr/lib/libhogweed.so.bak /usr/lib/libhogweed.so
mv /usr/lib/libgmp.so.bak /usr/lib/libgmp.so

Ugly but it works.

Regards

I just now seen this today.. Been out of the loops for some time.. but this temp workaround that you
posted seems to be the best fit for Arch systems. as you said, its ugly, but if it works, then its what
ill try... I havent tried as of writing this post.. but pretty sure its good.. and its the best workaround
answer I have received yet for arch systems.. I refuse to change my system out to ubuntu.
and already tried the VM machine. under ubuntu and still have some other weird errors...

But thanks for your input and help...

This should now be fixed: https://github.com/openwrt/packages/pull/17839