Schard
November 19, 2024, 2:40pm
1
I get this error in an MRE:
use bzip2::{write::BzEncoder, Compression};
use std::io::Cursor;
fn main() {
let file = Cursor::new(Vec::new());
let encoder = BzEncoder::new(file, Compression::best());
println!("Hello, world!");
}
~/bzip_mre> cargo build --target armv7-unknown-linux-musleabihf --release
Compiling bzip2-sys v0.1.11+1.0.8
The following warnings were emitted during compilation:
warning: bzip2-sys@0.1.11+1.0.8: Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `arm-linux-musleabihf-gcc` installed?
error: failed to run custom build command for `bzip2-sys v0.1.11+1.0.8`
Caused by:
process didn't exit successfully: `/home/neumann/bzip_mre/target/release/build/bzip2-sys-335d9c77934eaada/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=BZIP2_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_armv7-unknown-linux-musleabihf
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_armv7_unknown_linux_musleabihf
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_armv7-unknown-linux-musleabihf
cargo:rerun-if-env-changed=PKG_CONFIG_armv7_unknown_linux_musleabihf
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7-unknown-linux-musleabihf
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7_unknown_linux_musleabihf
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
OPT_LEVEL = Some(3)
TARGET = Some(armv7-unknown-linux-musleabihf)
HOST = Some(x86_64-unknown-linux-gnu)
cargo:rerun-if-env-changed=CC_armv7-unknown-linux-musleabihf
CC_armv7-unknown-linux-musleabihf = None
cargo:rerun-if-env-changed=CC_armv7_unknown_linux_musleabihf
CC_armv7_unknown_linux_musleabihf = None
cargo:rerun-if-env-changed=TARGET_CC
TARGET_CC = None
cargo:rerun-if-env-changed=CC
CC = None
cargo:rerun-if-env-changed=CROSS_COMPILE
CROSS_COMPILE = None
RUSTC_LINKER = None
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `arm-linux-musleabihf-gcc` installed?
RUSTC_WRAPPER = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some(false)
CARGO_CFG_TARGET_FEATURE = None
cargo:rerun-if-env-changed=CFLAGS_armv7-unknown-linux-musleabihf
CFLAGS_armv7-unknown-linux-musleabihf = None
cargo:rerun-if-env-changed=CFLAGS_armv7_unknown_linux_musleabihf
CFLAGS_armv7_unknown_linux_musleabihf = None
cargo:rerun-if-env-changed=TARGET_CFLAGS
TARGET_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
--- stderr
error occurred: Failed to find tool. Is `arm-linux-musleabihf-gcc` installed?
~/bzip_mre>
I never needed this arm-linux-musleabihf-gcc for cross compilation to armv7 on any other projects of mine that do not use bzip2. Why do I need it here? My distribution does not provide said binary. How can I get this compiled?
jofas
November 19, 2024, 2:57pm
2
Schard:
Why do I need it here?
bzip2-sys
tries to build libz2 from source if it can't find it with pkg-config or if the static
feature is enabled. Setting the CC
environment variable to the C compiler provided for your target platform might solve your problem.
1 Like
Schard
November 19, 2024, 3:04pm
3
I see. It's not a native Rust library and links to C code.
And this cannot be done without specialized gcc tools?
Schard
November 19, 2024, 3:31pm
4
I am a step further. I tried several linker env vars, including the ones with different target triplets, but it always fails:
= note: /usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
error: could not compile `yocto-buildserver` (bin "yocto-buildserver") due to 1 previous error
~/RustroverProjects/yocto-buildserver>
It always tries to use /usr/bin/ld
and ignores the env vars.
jofas
November 19, 2024, 3:40pm
5
I'd say that is the easiest option. Arm ships a whole C toolchain . Although while I typed this I realised that you want to build for musl, so using the right musl cross-compilation toolchain would be best I think.
2 Likes
Schard
November 19, 2024, 3:51pm
6
Well, I installed muslcc-arm-linux-musleabi-cross-bin
now, but I still need to explicitly feed cargo the compiler and it then still does not link:
~/bzip_mre> CC=/opt/muslcc/arm-linux-musleabi-cross/bin/arm-linux-musleabi-cc cargo build --target=arm-unknown-linux-musleabihf
Compiling bzip2-sys v0.1.11+1.0.8
Compiling bzip2 v0.4.4
Compiling bzip_mre v0.1.0 (/home/neumann/bzip_mre)
warning: unused variable: `encoder`
--> src/main.rs:6:9
|
6 | let encoder = BzEncoder::new(file, Compression::best());
| ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_encoder`
|
= note: `#[warn(unused_variables)]` on by default
error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/home/neumann/.cargo/bin:/home/neumann/.cargo/bin:/usr/local/bin:/usr/bin" VSLANG="1033" "cc" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crti.o" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtbegin.o" "/tmp/rustcl0AITY/symbols.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.04272vq5ioh33yzn331esh99t.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.0i60ib34abdoh3gxjakhfl883.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.0znftne1djx8c63fqk7v3a62s.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.1abvqhvaf389w1fel4r7r5yso.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.1bfral323bwteal7ckz0nknwt.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.1lhrpn1oj0h710fdph5za61mn.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.1qjvhi7dxuy9srfoob84g0w9p.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.1shmrtvm0r1somfzw1r6bky2i.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.1vcsl8nfodl59meawiliujs0y.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.2dml9a70r4vj6vroxfcu9anz5.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.3qn3jbkjskogtc1bz0wh3womt.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.3r8n0k9x4coifpy56v4qytny7.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.544nh97i48zb2nucz38q9ng30.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.5a3zlmek765cvzc7elqahf37e.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.6brh6kauhbqa1q4qw66cq31b0.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.6fxiwejq5axdys84gru35ojr4.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.851j9voe5ysh50x2i3l2pcbnj.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.8zumn8ttlbyfkffsdk5gb498m.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.9njjy5rzits2t4305bttyenys.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.9t3qs9f9vqqs8minlycwyaobj.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.a30zmtbw5a78j8ign2lpf7la2.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.b7f4uzsa2z1fd6h6ytpy2kwr3.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.b7vilkylqi645wnpvifbb0egf.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.bksyshz85aca36j35fhip0tfj.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.bligy1lat4cak1n5dkwfev7a3.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.c7axdg865nd9dws5sbbc8r1qg.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.cu2njasv8ymvwrajhytvirh20.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.dk8sqysn17vxh6pr4rfvlhqcv.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.e6zjc78t4ro210ikdoyz97p7w.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.e7ylu34137jo4swi1bx8eznyk.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.e9x1ymhvirgjrvv5hlkx0vqr4.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.ejm0lqpco27ktuorlrxxasq2t.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.42253w0drtbr0qwi2frx4ojwh.rcgu.o" "-Wl,--as-needed" "-Wl,-Bstatic" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/libbzip2-79e0fc653079c976.rlib" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/libbzip2_sys-aa2aa25c212976c1.rlib" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/liblibc-6f0586406053d17b.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libstd-b8589af99aaef9a4.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libpanic_unwind-20feab548a8b12f7.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libobject-b2d5e88979250a68.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libmemchr-f4b129a93599c138.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libaddr2line-c37808498c2003aa.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libgimli-8fe19cd124c8b25b.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_demangle-0fab790b86dd4cbc.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libstd_detect-52b268cfc492a0bd.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libhashbrown-914e5b87ea8eb7b6.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_std_workspace_alloc-98aaf27994c5c862.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libminiz_oxide-3f3a9f055fc7bafb.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libadler-1bd7c5515ee6a7bd.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libunwind-2ef2a7b95648c543.rlib" "-lunwind" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcfg_if-306e015c5202b853.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/liblibc-429cd92077e914c1.rlib" "-lc" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/liballoc-cdcad1af1e334391.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_std_workspace_core-7ef2d28bef102126.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcore-eee3929f0859d98e.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcompiler_builtins-75a57b9a30dc7ec2.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-nostartfiles" "-L" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/build/bzip2-sys-64e5eedb9d82200a/out/lib" "-L" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained" "-L" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib" "-o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70" "-Wl,--gc-sections" "-static" "-no-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtend.o" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtn.o"
= note: /usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
warning: `bzip_mre` (bin "bzip_mre") generated 1 warning
error: could not compile `bzip_mre` (bin "bzip_mre") due to 1 previous error; 1 warning emitted
~/bzip_mre>
EDIT: Ooof. Was missing the -hf suffix. Now I got the right package.
jofas
November 19, 2024, 3:56pm
7
Did it work? If not you might need to set the linker for your target to the one provided by the musl toolchain as well.
Schard
November 19, 2024, 4:02pm
8
No. I celebrated too early.
And rustc still ignores the linker var:
~/bzip_mre> CARGO_TARGET_ARMV7_UNKNOWN_LINUX_MUSLEABIHF_LINKER=/opt/muslcc/arm-linux-musleabihf-cross/bin/arm-linux-musleabihf-ld CC=/opt/muslcc/arm-linux-musleabihf-cross/bin/arm-linux-musleabihf-gcc cargo build --target=arm-unknown-linux-musleabihf
Compiling bzip_mre v0.1.0 (/home/neumann/bzip_mre)
warning: unused variable: `encoder`
--> src/main.rs:6:9
|
6 | let encoder = BzEncoder::new(file, Compression::best());
| ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_encoder`
|
= note: `#[warn(unused_variables)]` on by default
error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/home/neumann/.cargo/bin:/home/neumann/.cargo/bin:/usr/local/bin:/usr/bin" VSLANG="1033" "cc" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crti.o" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtbegin.o" "/tmp/rustcoQ9hpD/symbols.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.04272vq5ioh33yzn331esh99t.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.0i60ib34abdoh3gxjakhfl883.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.0znftne1djx8c63fqk7v3a62s.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.1abvqhvaf389w1fel4r7r5yso.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.1bfral323bwteal7ckz0nknwt.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.1lhrpn1oj0h710fdph5za61mn.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.1qjvhi7dxuy9srfoob84g0w9p.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.1shmrtvm0r1somfzw1r6bky2i.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.1vcsl8nfodl59meawiliujs0y.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.2dml9a70r4vj6vroxfcu9anz5.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.3qn3jbkjskogtc1bz0wh3womt.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.3r8n0k9x4coifpy56v4qytny7.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.544nh97i48zb2nucz38q9ng30.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.5a3zlmek765cvzc7elqahf37e.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.6brh6kauhbqa1q4qw66cq31b0.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.6fxiwejq5axdys84gru35ojr4.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.851j9voe5ysh50x2i3l2pcbnj.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.8zumn8ttlbyfkffsdk5gb498m.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.9njjy5rzits2t4305bttyenys.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.9t3qs9f9vqqs8minlycwyaobj.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.a30zmtbw5a78j8ign2lpf7la2.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.b7f4uzsa2z1fd6h6ytpy2kwr3.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.b7vilkylqi645wnpvifbb0egf.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.bksyshz85aca36j35fhip0tfj.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.bligy1lat4cak1n5dkwfev7a3.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.c7axdg865nd9dws5sbbc8r1qg.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.cu2njasv8ymvwrajhytvirh20.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.dk8sqysn17vxh6pr4rfvlhqcv.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.e6zjc78t4ro210ikdoyz97p7w.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.e7ylu34137jo4swi1bx8eznyk.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.e9x1ymhvirgjrvv5hlkx0vqr4.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.ejm0lqpco27ktuorlrxxasq2t.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70.42253w0drtbr0qwi2frx4ojwh.rcgu.o" "-Wl,--as-needed" "-Wl,-Bstatic" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/libbzip2-79e0fc653079c976.rlib" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/libbzip2_sys-aa2aa25c212976c1.rlib" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/liblibc-6f0586406053d17b.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libstd-b8589af99aaef9a4.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libpanic_unwind-20feab548a8b12f7.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libobject-b2d5e88979250a68.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libmemchr-f4b129a93599c138.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libaddr2line-c37808498c2003aa.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libgimli-8fe19cd124c8b25b.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_demangle-0fab790b86dd4cbc.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libstd_detect-52b268cfc492a0bd.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libhashbrown-914e5b87ea8eb7b6.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_std_workspace_alloc-98aaf27994c5c862.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libminiz_oxide-3f3a9f055fc7bafb.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libadler-1bd7c5515ee6a7bd.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libunwind-2ef2a7b95648c543.rlib" "-lunwind" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcfg_if-306e015c5202b853.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/liblibc-429cd92077e914c1.rlib" "-lc" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/liballoc-cdcad1af1e334391.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_std_workspace_core-7ef2d28bef102126.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcore-eee3929f0859d98e.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcompiler_builtins-75a57b9a30dc7ec2.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-nostartfiles" "-L" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/build/bzip2-sys-64e5eedb9d82200a/out/lib" "-L" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained" "-L" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib" "-o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-dc258cb3e1c4ee70" "-Wl,--gc-sections" "-static" "-no-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtend.o" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtn.o"
= note: /usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
warning: `bzip_mre` (bin "bzip_mre") generated 1 warning
error: could not compile `bzip_mre` (bin "bzip_mre") due to 1 previous error; 1 warning emitted
~/bzip_mre>
I am really surprised that this is so complicated. I cross-compiled numerous projects for ARMv7 and never had to run the gauntlet like this.
Schard
November 20, 2024, 9:39am
9
I now tried to set it in .cargo/config.toml
as per 1 :
~/bzip_mre> cat .cargo/config.toml
[target.armv7-unknown-linux-musleabihf]
linker = "arm-linux-musleabihf-gcc"
Still no dice:
~/bzip_mre> CC=/opt/muslcc/arm-linux-musleabihf-cross/bin/arm-linux-musleabihf-gcc cargo build --target=arm-unknown-linux-musleabihf
Compiling bzip_mre v0.1.0 (/home/neumann/bzip_mre)
warning: unused variable: `encoder`
--> src/main.rs:6:9
|
6 | let encoder = BzEncoder::new(file, Compression::best());
| ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_encoder`
|
= note: `#[warn(unused_variables)]` on by default
error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/home/neumann/.cargo/bin:/home/neumann/.cargo/bin:/usr/local/bin:/usr/bin" VSLANG="1033" "cc" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crti.o" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtbegin.o" "/tmp/rustcDjHVNM/symbols.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.0csjytxe6e4t8cosjkl5goa8g.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.0d3fgvw17bsayal4si5pl7x1j.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.139gplzzostfmyii9en4fwjp5.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.1ipak603qvyxvlflpcxn02mkx.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.1y67ntm6zrsiucoji1jdldcyn.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.25yjd4zlz16i1ug2nmbbq6lf8.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.2swg2wd7vakq8mexohvzno6id.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.4lnazhv68hilj0cqnx221aw0e.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.4r9r83grylbz038atoxqcyy4w.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.6cin6fd8dpxqo5h0wp73dzx16.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.6mn43it9ltefi2nxxnq8zzbg7.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.6uakav6vy06oosiobwh48n1es.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.84iiqmmkj2bvilz6mxinqt9fj.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.88ni0nr8nqm4h806b0qs3d1cr.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.8i042bdz64z0h2e98johjy5dz.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.922gf22szbkm9yjvn699dayaj.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.9rfj95dro7w3v9fz7toksurvx.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.a2b3sudoh8ibol6fgeg5r2e32.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.ajbkn947014p8uup6m2rxui4y.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.ajvf3cus2rxgqtsjaawvk27hg.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.al9z4p861e3nlwngzgn5rzmev.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.bog74f9tx9o2fie1te0xbkpgi.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.cjctr18cwkdi4mcnwlv8bdmla.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.cvtltyrnumhm76l7s5dt65pru.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.dc1owb8e82qy5jhz9dn82vwfv.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.dj15a78r7nz4ld79l14txu5qr.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.ds43h6lhfp4muopzdp4lf22tq.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.dwem9z2cf7xyqwuybbdnds2jl.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.eb1mrvgpsz6hujc1oj794fr2y.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.emo4qwsb1ubt5k4laxc7oiv6y.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.ewh0fwvyb9cx3kuy1st2ro7sh.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.f1oxp6a3jtmzmas20jtl895o6.rcgu.o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7.befxgy25rzdgcz9py7tlg4ypx.rcgu.o" "-Wl,--as-needed" "-Wl,-Bstatic" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/libbzip2-c335c5e3fba6b650.rlib" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/libbzip2_sys-a766a9b3cf1326f6.rlib" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/liblibc-6f0586406053d17b.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libstd-b8589af99aaef9a4.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libpanic_unwind-20feab548a8b12f7.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libobject-b2d5e88979250a68.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libmemchr-f4b129a93599c138.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libaddr2line-c37808498c2003aa.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libgimli-8fe19cd124c8b25b.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_demangle-0fab790b86dd4cbc.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libstd_detect-52b268cfc492a0bd.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libhashbrown-914e5b87ea8eb7b6.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_std_workspace_alloc-98aaf27994c5c862.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libminiz_oxide-3f3a9f055fc7bafb.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libadler-1bd7c5515ee6a7bd.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libunwind-2ef2a7b95648c543.rlib" "-lunwind" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcfg_if-306e015c5202b853.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/liblibc-429cd92077e914c1.rlib" "-lc" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/liballoc-cdcad1af1e334391.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_std_workspace_core-7ef2d28bef102126.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcore-eee3929f0859d98e.rlib" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcompiler_builtins-75a57b9a30dc7ec2.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-nostartfiles" "-L" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/build/bzip2-sys-322e382cc147f342/out/lib" "-L" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained" "-L" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib" "-o" "/home/neumann/bzip_mre/target/arm-unknown-linux-musleabihf/debug/deps/bzip_mre-e85d9759fdc95fc7" "-Wl,--gc-sections" "-static" "-no-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtend.o" "/home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtn.o"
= note: /usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/neumann/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
warning: `bzip_mre` (bin "bzip_mre") generated 1 warning
error: could not compile `bzip_mre` (bin "bzip_mre") due to 1 previous error; 1 warning emitted
~/bzip_mre>
Schard
November 20, 2024, 9:43am
10
Got it. Had a typo in the target:
~/bzip_mre> cat .cargo/config.toml 2024-11-20T10:41:56
[target.armv7-unknown-linux-musleabihf]
linker = "rust-lld"
~/bzip_mre> CC=/opt/muslcc/arm-linux-musleabihf-cross/bin/arm-linux-musleabihf-gcc cargo build --target=armv7-unknown-linux-musleabihf
Compiling shlex v1.3.0
Compiling libc v0.2.164
Compiling pkg-config v0.3.31
Compiling cc v1.2.1
Compiling bzip2-sys v0.1.11+1.0.8
Compiling bzip2 v0.4.4
Compiling bzip_mre v0.1.0 (/home/neumann/bzip_mre)
warning: unused variable: `encoder`
--> src/main.rs:6:9
|
6 | let encoder = BzEncoder::new(file, Compression::best());
| ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_encoder`
|
= note: `#[warn(unused_variables)]` on by default
warning: `bzip_mre` (bin "bzip_mre") generated 1 warning
Finished `dev` profile [unoptimized + debuginfo] target(s) in 2.10s
~/bzip_mre>