zstd-rs
zstd-rs copied to clipboard
Cross building for armhf fails with "hidden symbol 'ZSTD_isError'" linker error
Hi,
Thanks for this neat zstd library. I'm trying to use it in our software and was able to use it successfully for both aarch64
and amd64
architectures without a problem. But I also need it for armhf
architecture and bumped to a build problem which I couldn't resolve.
Here's the build result for armhf
cross compilation on amd64
machine (bindgen
feature not enabled):
2024-06-21 05:56:05.115 :: Compiling zstd-sys v2.0.11+zstd.1.5.6
2024-06-21 05:56:07.746 :: Compiling zstd v0.13.1
2024-06-21 05:56:08.022 :: Compiling device-manager v0.1.0 (/var/root-project/parts/rust-services/build/device-manager)
2024-06-21 05:56:51.627 :: error: linking with `arm-linux-gnueabihf-gcc` failed: exit status: 1
2024-06-21 05:56:51.628 :: |
2024-06-21 05:56:51.628 :: = note: LC_ALL="C" PATH="/var/root-project/stage/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/var/root-project/stage/usr/bin:/var/root-project/stage/sbin:/var/root-project/stage/bin:/snap/snapcraft/11039/libexec/snapcraft:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/root-project/stage/opt/cargo/bin" VSLANG="1033" "arm-linux-gnueabihf-gcc" "/tmp/rustck0JY1g/symbols.o" "/var/root-project/parts/rust-services/build/target/armv7-unknown-linux-gnueabihf/release/deps/device_manager-22501b77a62423dd.device_manager.c0b6ae309808d4c8-cgu.0.rcgu.o" "-Wl,--as-needed" "-L" "/var/root-project/parts/rust-services/build/target/armv7-unknown-linux-gnueabihf/release/deps" "-L" "/var/root-project/parts/rust-services/build/target/release/deps" "-L" "/var/root-project/stage/usr/lib/arm-linux-gnueabihf" "-L" "/var/root-project/stage/var/root-project/stage/usr/lib/arm-linux-gnueabihf" "-L" "/var/root-project/stage/usr/lib/arm-linux-gnueabihf" "-L" "/var/root-project/parts/rust-services/build/target/armv7-unknown-linux-gnueabihf/release/build/zstd-sys-3a5fac7ca05b3e6a/out" "-L" "/var/root-project/stage/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-Wl,-Bstatic" "/tmp/rustck0JY1g/libzstd_sys-e9558b8d5f899acd.rlib" "/var/root-project/stage/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libcompiler_builtins-ca98583dba9cbc39.rlib" "-Wl,-Bdynamic" "-lsystemd" "-ldbus-1" "-lssl" "-lcrypto" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/var/root-project/stage/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-o" "/var/root-project/parts/rust-services/build/target/armv7-unknown-linux-gnueabihf/release/deps/device_manager-22501b77a62423dd" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,--strip-debug" "-nodefaultlibs" "-Wl,-rpath-link,/var/root-project/stage/lib/arm-linux-gnueabihf/" "-Wl,-rpath-link,/var/root-project/stage/usr/lib/arm-linux-gnueabihf/" "-Wl,--allow-shlib-undefined"
2024-06-21 05:56:51.628 :: = note: /usr/lib/gcc-cross/arm-linux-gnueabihf/11/../../../../arm-linux-gnueabihf/bin/ld: /var/root-project/parts/rust-services/build/target/armv7-unknown-linux-gnueabihf/release/deps/device_manager-22501b77a62423dd: hidden symbol `ZSTD_isError' in /tmp/rustck0JY1g/libzstd_sys-e9558b8d5f899acd.rlib(zstd_common.o) is referenced by DSO
2024-06-21 05:56:51.628 :: /usr/lib/gcc-cross/arm-linux-gnueabihf/11/../../../../arm-linux-gnueabihf/bin/ld: final link failed: bad value
2024-06-21 05:56:51.629 :: collect2: error: ld returned 1 exit status
2024-06-21 05:56:51.629 ::
2024-06-21 05:56:51.629 ::
2024-06-21 05:56:51.666 :: error: could not compile `device-manager` (bin "device-manager") due to 1 previous error
Note: If I cross build zstd-rs
for armhf
, everything is alright. The problem arises at linking time.
OS: Ubuntu 22.04 Rust: 1.79 stable for amd64 and armhf, Edition 2021
Regards, /// Murat