Description
I am trying to use the GHA aarch64-unknown-linux-gnu runners to build and run my code for armv7-unknown-linux-gnueabihf. Since my code depends on the rustc crates, I cannot do actual cross-compilation. Instead, I am installing the armv7-unknown-linux-gnueabihf version of rustc on that system. rustc
itself runs successfully since I installed enough multiarch packages. However, Rust fails to actually build any binaries in this setup (specifically, it fails to build the build scripts):
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "/tmp/rustcWH48QS/symbols.o" "<4 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/rustcWH48QS/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-o" "/home/runner/work/miri/miri/target/release/build/libc-3375c08ac196722c/build_script_build-3375c08ac196722c" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,--strip-debug" "-nodefaultlibs" "-Wl,-rpath,<sysroot>/lib/rustlib/armv7-unknown-linux-gnueabihf/lib"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: /usr/bin/ld: /tmp/rustcWH48QS/symbols.o: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
error: could not compile `libc` (build script) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "/tmp/rustcwYoYoY/symbols.o" "<4 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/rustcwYoYoY/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-o" "/home/runner/work/miri/miri/target/release/build/zerocopy-f22a37c7a8ae1a41/build_script_build-f22a37c7a8ae1a41" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,--strip-debug" "-nodefaultlibs" "-Wl,-rpath,<sysroot>/lib/rustlib/armv7-unknown-linux-gnueabihf/lib"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: /usr/bin/ld: /tmp/rustcwYoYoY/symbols.o: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
error: could not compile `zerocopy` (build script) due to 1 previous error
I have no idea about any of the internals here, but I suspect that cc
needs to be told that this is a cross-compilation situation, since the host cc
will by default build for aarch64-unknown-linux-gnu but rustc is building for armv7-unknown-linux-gnueabihf. I tried to set the CC
env var to arm-linux-gnueabihf-gcc
but that changed nothing.