Suricata 6.0.4: /usr/bin/ld: error adding symbols: file in wrong format

I am building suricata to be included as a package in OpenWrt. Currently, I have incorporated rust-lang into the OpenWrt build system. When building suricata 6.0.4 in a cross-compile (x86_64-unknown-linux-gnu to mips64-openwrt-linux-musl with the appropriate rust-lang tuple toolchain)

*** snip ***
          /usr/bin/ld: /home/grommish/openwrt/build_dir/target-mips64_octeonplus_64_musl/suricata-6.0.4/rust/target/mips64-openwrt-linux-musl/release/deps/suricata.suricata.a4d2e0c5-cgu.0.rcgu.o: error adding symbols: file in wrong format
          collect2: error: ld returned 1 exit status

Full Log:

Short description:
When running ./autogen.sh and ./configure, the scripts correctly identify the linker as

checking for ld used by mips64-openwrt-linux-musl-gcc... mips64-openwrt-linux-musl-ld.gold
checking if the linker (mips64-openwrt-linux-musl-ld.gold) is GNU ld... yes

but when actually linking, it attempts to use /usr/bin/ld.

I’m passing --with-sysroot on the configure, and it’s correctly being ID’d. Am I missing a configure flag, or is this an unintentional error?

Added Issue as Bug #5039: suricata 6.0.4: hard-coded linker results in errors - Suricata - Open Information Security Foundation

bump for visibility.

I’m even grateful for a suggestion where to start looking. :smiley:

Thanks!