Cross-compiling for ARMv8

Hi,

I am trying to crosscompiling for ARMv8 on Arch Linux. I have installed the package aarch64-linux-gnu-gcc, but when I compile the default project (just created with cargo new cctest) with cargo build --target=aarch64-unknown-linux-gnu I am getting the following error:

error: linking with `cc` failed: exit code: 1
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-Wl,--eh-frame-hdr" "-L"  [...] "-Wl,-Bdynamic" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-ldl" "-lutil"
  = note: /usr/bin/ld: /home/xyz/cctest/target/aarch64-unknown-linux-gnu/debug/deps/ccomp-c3a6ca5c8d807c9b.1crrfu22d9mqqynf.rcgu.o: Relocations in generic ELF (EM: 183)

So it seems that is using the wrong linker.
What am I doing wrong?

Thanks

Ok... I found the problem, I just forgot to create the .cargo/config file with the following setting:

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"

Shame on me :blush:

1 Like