Suricata-lua-sys cross compilation issue

I have seem cannot get around the following cross compilation errors targeting aarch64 :

   Compiling sawp-modbus v0.12.1
   Compiling kerberos-parser v0.8.0
   Compiling x509-parser v0.16.0
   Compiling suricata v8.0.0-dev (/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust)
error: linking with `aarch64-openwrt-linux-gnu-gcc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/bin:/home/user/works/openwrt/staging_dir/hostpkg/bin:/home/user/works/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-14.2.0_glibc/bin:/home/user/works/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-14.2.0_glibc/bin:/home/user/works/openwrt/staging_dir/host/bin:/home/user/works/openwrt/staging_dir/host/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" "aarch64-openwrt-linux-gnu-gcc" "-Wl,--version-script=/home/user/works/openwrt/tmp/rustc0ynbmR/list" "-Wl,--no-undefined-version" "/home/user/works/openwrt/tmp/rustc0ynbmR/symbols.o" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/suricata.suricata.83e7a4b7b8211a74-cgu.00.rcgu.o" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/suricata.suricata.83e7a4b7b8211a74-cgu.01.rcgu.o" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/suricata.suricata.83e7a4b7b8211a74-cgu.02.rcgu.o" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/suricata.suricata.83e7a4b7b8211a74-cgu.03.rcgu.o" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/suricata.suricata.83e7a4b7b8211a74-cgu.04.rcgu.o" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/suricata.suricata.83e7a4b7b8211a74-cgu.05.rcgu.o" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/suricata.suricata.83e7a4b7b8211a74-cgu.06.rcgu.o" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/suricata.suricata.83e7a4b7b8211a74-cgu.07.rcgu.o" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/suricata.suricata.83e7a4b7b8211a74-cgu.08.rcgu.o" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/suricata.suricata.83e7a4b7b8211a74-cgu.09.rcgu.o" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/suricata.suricata.83e7a4b7b8211a74-cgu.10.rcgu.o" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/suricata.suricata.83e7a4b7b8211a74-cgu.11.rcgu.o" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/suricata.suricata.83e7a4b7b8211a74-cgu.12.rcgu.o" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/suricata.suricata.83e7a4b7b8211a74-cgu.13.rcgu.o" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/suricata.suricata.83e7a4b7b8211a74-cgu.14.rcgu.o" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/suricata.suricata.83e7a4b7b8211a74-cgu.15.rcgu.o" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/suricata.cs4xpic8cdv7myvw87s38ftdn.rcgu.o" "-Wl,--as-needed" "-Wl,-Bstatic" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libhex-0342f12da5669aae.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libsuricata_lua_sys-aa84b62c611760f2.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/liblzma_rs-dfe826cd4dd58b20.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libbendy-31aaa0f4a86fcd8e.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libfailure-b8e07a370122fb4e.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libnum-8a58cc7515af9328.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libnum_rational-6d082fe4890c2e1e.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libnum_iter-57b9636cd017c7c5.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libnum_complex-65b75dc076bd76d8.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libnum_bigint-21b6b4aed403a97b.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libhkdf-a61b5f57cbd94f88.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libhmac-01cc4f6a054b65ad.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libaes_gcm-9a407808aa8d2a4d.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libghash-e044f72f9b791d82.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libpolyval-4d0aa2e3376ab905.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libuniversal_hash-188f2251d9e4e5d1.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libctr-b7605d04363c0e9d.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libaead-f0769e8ef969ec10.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libaes-2a633be789658ad3.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libopaque_debug-7aed73028cd4bd2f.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libcipher-286aab03ac7699e5.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libbrotli-f67ddb0d2edf9473.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libbrotli_decompressor-d4d8e1ea44f8e7ab.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/liballoc_stdlib-0c9d223cd9ed4e43.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/liballoc_no_stdlib-480d933bac4d707d.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libflate2-2b88361369b37f1a.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libminiz_oxide-bc68f90400bf0ad3.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libadler2-0aa1e6981e8a2410.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libcrc32fast-54d0b5db56d1b42b.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libsawp_modbus-4d2b0ebb6978a4cc.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libnum_enum-c560985b1e21a8ed.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libsawp-f3f50506264caafa.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libsawp_flags-4a622b11f038360d.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libregex-ef0cfe1bb9a84402.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libaho_corasick-0ceb7721cb0870db.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libregex_syntax-754ed480c92bce71.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libuuid-c71861e9b3cbbd54.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/liblibc-ba1ae81ba84b68f7.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libsha2-289b722f0e2b4695.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libsha1-01c6c780e9f1face.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libmd5-325f5f1dffa7871b.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libcfg_if-efd1d5cc09c542af.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libdigest-ae35aa5ceef445cc.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libsubtle-17f4aebacad3f975.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libblock_buffer-fa7bff2a37ee201b.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libcrypto_common-01401e6c32be9e87.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libgeneric_array-6b9016a368d3947f.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libtypenum-f890fbd69f6a579e.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libbase64-09c724189fa34d27.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libntp_parser-290a06262c685479.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libsnmp_parser-c7747e1100164ec7.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libipsec_parser-c2003a08365ead79.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libldap_parser-96003ff97d98ed18.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libx509_parser-1f0d990e8d43603a.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libdata_encoding-af99d6d69eb1425d.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/liblazy_static-921eddc0821b99bb.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/liboid_registry-2ca4435df172e71f.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libtls_parser-3415977ad0f52a45.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libphf-b0084da65980d84b.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libphf_shared-b5f7fb1c2cca8c0c.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libsiphasher-0f0fb8ac0656c290.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libenum_primitive-a651990976aefeb0.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libnum_traits-0a113098868a30f7.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libnom_derive-6ab82fe4430cef77.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libkerberos_parser-5951e6f842881e73.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libder_parser-1663d2201d368682.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libnum_bigint-e0cd46a5fd3e7661.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libnum_integer-4b55e9f2c816815a.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libasn1_rs-101d6893c3842f7b.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libthiserror-e9b5f32f05731f10.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/librusticata_macros-8d239b5a2fe87f02.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libnom-99cf817f864a1570.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libnum_traits-96b4deeba7a46450.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libtime-f319a0f7f5d9b672.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libitoa-1402b6d18b215623.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libtime_core-9df7dab91cfe001a.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libnum_conv-b169e3a2295fbab7.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libderanged-3715a5041489cb14.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libpowerfmt-0756ac8073713827.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libwidestring-7be92cf6588bdb50.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/liblru-7e7015f6ca0bdfb7.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libhashbrown-309ef2f1a2b8707a.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libfoldhash-e81fa1a1329168eb.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libequivalent-7eee658247f9e330.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/liballocator_api2-72793926f2f7cc4d.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libmemchr-24a0758c12fec0fc.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libcrc-410c3fe3698eaaec.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libbyteorder-53c11dde7f3c4532.rlib" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libbitflags-db6b3fb736ac0ddc.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd-afc4ff9b2fac7068.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libpanic_unwind-424f260329c43643.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libobject-c6e9438499274ce3.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libmemchr-63d5302137084312.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libaddr2line-483b1eca634e78b1.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libgimli-5c4894f87a9167cd.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_demangle-10338ccc43ab2939.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd_detect-5763a769141f6854.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libhashbrown-09405765fc7052f8.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-9e8b9342cc6e0701.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libminiz_oxide-bdb4f2e45eb457f9.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libadler-2f58e3ce6fa2b348.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libunwind-d46e491762f5046e.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcfg_if-391bcd2c4147b472.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/liblibc-8134c6a144527b35.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/liballoc-28cf9a6be8ef386b.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_core-71e48809544db7f8.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcore-faab586bc5ad5736.rlib" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcompiler_builtins-c64e129d5516f209.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/build/suricata-lua-sys-0c80a8b93c34af31/out/lua" "-L" "/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/host/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-o" "/home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libsuricata.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs"
  = note: /home/user/works/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-14.2.0_glibc/lib/gcc/aarch64-openwrt-linux-gnu/14.2.0/../../../../aarch64-openwrt-linux-gnu/bin/ld: /home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libsuricata_lua_sys-aa84b62c611760f2.rlib(lapi.o): Relocations in generic ELF (EM: 62)
          /home/user/works/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-14.2.0_glibc/lib/gcc/aarch64-openwrt-linux-gnu/14.2.0/../../../../aarch64-openwrt-linux-gnu/bin/ld: /home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libsuricata_lua_sys-aa84b62c611760f2.rlib(lapi.o): Relocations in generic ELF (EM: 62)
          /home/user/works/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-14.2.0_glibc/lib/gcc/aarch64-openwrt-linux-gnu/14.2.0/../../../../aarch64-openwrt-linux-gnu/bin/ld: /home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libsuricata_lua_sys-aa84b62c611760f2.rlib(lapi.o): Relocations in generic ELF (EM: 62)
          /home/user/works/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-14.2.0_glibc/lib/gcc/aarch64-openwrt-linux-gnu/14.2.0/../../../../aarch64-openwrt-linux-gnu/bin/ld: /home/user/works/openwrt/build_dir/target-aarch64_cortex-a53_glibc/suricata-8.0.0/rust/target/aarch64-unknown-linux-gnu/release/deps/libsuricata_lua_sys-aa84b62c611760f2.rlib: error adding symbols: file in wrong format
          collect2: error: ld returned 1 exit status
          

error: could not compile `suricata` (lib) due to 1 previous error
make[4]: *** [Makefile:554: all-local] Error 101

TARGET_CC & HOST_CC is already defined :

export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-openwrt-linux-gnu-gcc
export TARGET_CC=aarch64-openwrt-linux-gnu-gcc
export HOST_CC=gcc

Excerpt from configuration line :

CONFIGURE_ARGS += \
  --target=$(RUSTC_TARGET_ARCH) \
  --host=$(RUSTC_TARGET_ARCH) \
  --build=$(GNU_HOST_NAME) \
  --enable-shared \
  --disable-silent-rules \
  --disable-maintainer-mode \
  --disable-dependency-tracking \
  --disable-gccmarch-native \
  --disable-gccprofile \
  --with-gnu-ld \
  --with-sysroot=$(STAGING_DIR)

Build host x86_64 glibc targeting aarch64-unknown-linux-gnu glibc (OpenWrt).

Do you have an example of you would successfully cross-compile Lua directly from Lua: download?

If so, I could make sure all the arguments make it through.

Yes i did

root@build:~# file /home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/root-bcm27xx/usr/lib/liblua5.4.so.0.0.0
/home/user/works/openwrt/staging_dir/target-aarch64_cortex-a53_glibc/root-bcm27xx/usr/lib/liblua5.4.so.0.0.0: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=, not stripped

Lua 5.4 OpenWrt Makefile located in here.

Most important lines :

define Build/Compile
	$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
		CC="$(TARGET_CROSS)gcc" \
		AR="$(TARGET_CROSS)ar rcu" \
		RANLIB="$(TARGET_CROSS)ranlib" \
		INSTALL_ROOT=/usr \
		CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
		PKG_VERSION=$(PKG_VERSION) \
		linux
	rm -rf $(PKG_INSTALL_DIR)
	mkdir -p $(PKG_INSTALL_DIR)
	$(MAKE) -C $(PKG_BUILD_DIR) \
		INSTALL_TOP="$(PKG_INSTALL_DIR)/usr" \
		install
endef

Manually changing suricata-lua-sys Makefile into :

CC= aarch64-openwrt-linux-gnu-gcc -std=gnu99
AR= aarch64-openwrt-linux-gnu-ar rcu
RANLIB= aarch64-openwrt-linux-gnu-ranlib

and changing Cargo.toml.in :

suricata-lua-sys = { path = "/home/user/works/suricata-lua-sys", version = "0.1.0-alpha.5" }

Make it compile.

But automatically by using :

export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-openwrt-linux-gnu-gcc
export CC=aarch64-openwrt-linux-gnu-gcc
export AR=aarch64-openwrt-linux-gnu-ar
export RANLIB=aarch64-openwrt-linux-gnu-ranlib

Doesn’t work.

It looks like the Lua Makefile we wrap does not support overriding these environment variables so its something we’ll have to add.

I don’t know much about cross compiling. WIth 7.0 which uses the system Lua, what does a full ./configure and make command line look like, with all environment variables and command line options. I’m mainly curious has CC is set, does ./configure take care that based on the --target parameter, or is it something you set yourself?

1 Like

Overriding those variables would be nice.

I am also not well verse in cross compiling, only a OpenWrt user, but afaik most important for cross compiling configure script are “–build” , “–host”, & “–target” arguments, more info in here.

I set the target myself, full OpenWrt Suricata 8 Makefile.

Managed to get a rough draft for Makefile variables changeable through export :

diff -Naur a/lua/Makefile b/lua/Makefile
--- a/lua/Makefile
+++ b/lua/Makefile
@@ -6,13 +6,13 @@
 # Your platform. See PLATS for possible values.
 PLAT= guess
 
-CC= gcc -std=gnu99
+CC?= gcc
 CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_3 $(SYSCFLAGS) $(MYCFLAGS)
 LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
 LIBS= -lm $(SYSLIBS) $(MYLIBS)
 
-AR= ar rcu
-RANLIB= ranlib
+AR?= ar
+RANLIB?= ranlib
 RM= rm -f
 UNAME= uname
 
@@ -57,14 +57,14 @@
 a:	$(ALL_A)
 
 $(LUA_A): $(BASE_O)
-	$(AR) $@ $(BASE_O)
+	$(AR) rcu $@ $(BASE_O)
 	$(RANLIB) $@
 
 $(LUA_T): $(LUA_O) $(LUA_A)
-	$(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+	$(CC) -std=gnu99 -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
 
 $(LUAC_T): $(LUAC_O) $(LUA_A)
-	$(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
+	$(CC) -std=gnu99 -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
 
 test:
 	./$(LUA_T) -v
@@ -73,7 +73,7 @@
 	$(RM) $(ALL_T) $(ALL_O)
 
 depend:
-	@$(CC) $(CFLAGS) -MM l*.c
+	@$(CC) -std=gnu99 $(CFLAGS) -MM l*.c
 
 echo:
 	@echo "PLAT= $(PLAT)"
@@ -133,7 +133,7 @@
 
 mingw:
 	$(MAKE) "LUA_A=lua54.dll" "LUA_T=lua.exe" \
-	"AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \
+	"AR=$(CC) -std=gnu99 -shared -o" "RANLIB=strip --strip-unneeded" \
 	"SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
 	$(MAKE) "LUAC_T=luac.exe" luac.exe
 
@@ -148,13 +148,13 @@
 
 # Compiler modules may use special flags.
 llex.o:
-	$(CC) $(CFLAGS) $(CMCFLAGS) -c llex.c
+	$(CC) -std=gnu99 $(CFLAGS) $(CMCFLAGS) -c llex.c
 
 lparser.o:
-	$(CC) $(CFLAGS) $(CMCFLAGS) -c lparser.c
+	$(CC) -std=gnu99 $(CFLAGS) $(CMCFLAGS) -c lparser.c
 
 lcode.o:
-	$(CC) $(CFLAGS) $(CMCFLAGS) -c lcode.c
+	$(CC) -std=gnu99 $(CFLAGS) $(CMCFLAGS) -c lcode.c
 
 # DO NOT DELETE
 

@ish
What do you think of my changes?, is there any chances for it getting committed upstream (suricata-lua-sys)?.