Собираю на Arch Linux на x86_64 машине, целевая платформа - NAS от Synology, там непонятно какой Linux и архитектура aarch64.
Пробовал таргеты aarch64-unknown-linux-gnu и aarch64-unknown-linux-musl
Пробовал поставить из AUR пакет aarch64-linux-musl-cross-bin
error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/bingo/.npm/bin:/home/bingo/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl" VSLANG="1033" "cc" "/tmp/rustcv1oBuS/symbols.o" "/home/bingo/proj/hello-arm/target/aarch64-unknown-linux-gnu/debug/deps/hello_arm-1139fdd90f04c851.15z9cx7yxwsn14aw.rcgu.o" "/home/bingo/proj/hello-arm/target/aarch64-unknown-linux-gnu/debug/deps/hello_arm-1139fdd90f04c851.2e9wmnqw8l559km3.rcgu.o" "/home/bingo/proj/hello-arm/target/aarch64-unknown-linux-gnu/debug/deps/hello_arm-1139fdd90f04c851.4rdiciape91uuibh.rcgu.o" "/home/bingo/proj/hello-arm/target/aarch64-unknown-linux-gnu/debug/deps/hello_arm-1139fdd90f04c851.4wfh3ivjpuqqti4j.rcgu.o" "/home/bingo/proj/hello-arm/target/aarch64-unknown-linux-gnu/debug/deps/hello_arm-1139fdd90f04c851.5eq7kolg8sysf5dm.rcgu.o" "/home/bingo/proj/hello-arm/target/aarch64-unknown-linux-gnu/debug/deps/hello_arm-1139fdd90f04c851.5fenpy12ifjee3.rcgu.o" "/home/bingo/proj/hello-arm/target/aarch64-unknown-linux-gnu/debug/deps/hello_arm-1139fdd90f04c851.3uqyc99hvh9b802l.rcgu.o" "-Wl,--as-needed" "-L" "/home/bingo/proj/hello-arm/target/aarch64-unknown-linux-gnu/debug/deps" "-L" "/home/bingo/proj/hello-arm/target/debug/deps" "-L" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd-34da74852bdef0e1.rlib" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libpanic_unwind-05795a800cd2cdf9.rlib" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libobject-9ca5ce02b9530f39.rlib" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libmemchr-cc69cebf3933588c.rlib" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libaddr2line-d732e0b493a8a4d6.rlib" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libgimli-d599f1e7056e270c.rlib" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_demangle-2970ab04bdcf9daa.rlib" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd_detect-b8eded6f75e91958.rlib" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libhashbrown-9d0aa7ebe95e3da6.rlib" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libminiz_oxide-6dc9a0300f784da5.rlib" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libadler-d88a2688c5a72639.rlib" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-64a3d52f4f97dac6.rlib" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libunwind-20698c7ea2d1cd6e.rlib" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcfg_if-f53d19488c86d7ea.rlib" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/liblibc-c52b6ff8d75b0dfb.rlib" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/liballoc-e39354c569fb34c7.rlib" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_core-2323de1608db6307.rlib" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcore-41714f15d12e745f.rlib" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcompiler_builtins-bf162290a815f192.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/home/bingo/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-o" "/home/bingo/proj/hello-arm/target/aarch64-unknown-linux-gnu/debug/deps/hello_arm-1139fdd90f04c851" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs"
= note: /usr/bin/ld: /home/bingo/proj/hello-arm/target/aarch64-unknown-linux-gnu/debug/deps/hello_arm-1139fdd90f04c851.15z9cx7yxwsn14aw.rcgu.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /home/bingo/proj/hello-arm/target/aarch64-unknown-linux-gnu/debug/deps/hello_arm-1139fdd90f04c851.15z9cx7yxwsn14aw.rcgu.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /home/bingo/proj/hello-arm/target/aarch64-unknown-linux-gnu/debug/deps/hello_arm-1139fdd90f04c851.15z9cx7yxwsn14aw.rcgu.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /home/bingo/proj/hello-arm/target/aarch64-unknown-linux-gnu/debug/deps/hello_arm-1139fdd90f04c851.15z9cx7yxwsn14aw.rcgu.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /home/bingo/proj/hello-arm/target/aarch64-unknown-linux-gnu/debug/deps/hello_arm-1139fdd90f04c851.15z9cx7yxwsn14aw.rcgu.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /home/bingo/proj/hello-arm/target/aarch64-unknown-linux-gnu/debug/deps/hello_arm-1139fdd90f04c851.15z9cx7yxwsn14aw.rcgu.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /home/bingo/proj/hello-arm/target/aarch64-unknown-linux-gnu/debug/deps/hello_arm-1139fdd90f04c851.15z9cx7yxwsn14aw.rcgu.o: Relocations in generic ELF (EM: 183)
/usr/bin/ld: /home/bingo/proj/hello-arm/target/aarch64-unknown-linux-gnu/debug/deps/hello_arm-1139fdd90f04c851.15z9cx7yxwsn14aw.rcgu.o: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
Нагуглил вот такие флаги:
RUSTFLAGS="-C link_arg=-lgcc -C link_arg=-specs -C link_arg=/usr/lib/aarch64-linux-musl/musl-gcc.specs"
Но тут проблема, что у меня нет файла /usr/lib/aarch64-linux-musl/musl-gcc.specs
Еще попробовал скачать
https://musl.cc/aarch64-linux-musl-cross.tgz и линковать линкером отсюда, но он ругается:
unrecognised emulation mode: elf_x86_64
Supported emulations: aarch64linux aarch64elf aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb aarch64linuxb aarch64linux32 aarch64linux32b armelfb_linux_eabi armelf_linux_eabi
Есть у меня конечно еще мысли поднять виртуалку в QEMU и эмулировать aarch64 проц, но может как-то проще можно?
Если что, компилирую обычный hello world, который генерирует cargo new --bin