# Cross-compiling for ARMv8

**URL:** <https://users.rust-lang.org/t/cross-compiling-for-armv8/51737>\
**Category:** help\
**Created:** [November 20, 2020, 8:27pm UTC](https://users.rust-lang.org/t/cross-compiling-for-armv8/51737 "2020-11-20T20:27:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![killkrt](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/killkrt/32/5339_2.png) [@killkrt](https://users.rust-lang.org/u/killkrt)\
**Post date:** [November 20, 2020, 8:27pm UTC](https://users.rust-lang.org/t/cross-compiling-for-armv8/51737/1 "2020-11-20T20:27:52Z")

</div>

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:

```rust
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

---

<div class="post-metadata">

**Author:** ![killkrt](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/killkrt/32/5339_2.png) [@killkrt](https://users.rust-lang.org/u/killkrt)\
**Post date:** [November 21, 2020, 1:54pm UTC](https://users.rust-lang.org/t/cross-compiling-for-armv8/51737/2 "2020-11-21T13:54:18Z")

</div>

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

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

```

Shame on me 😊

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/system/32/51372_2.png) [@system](https://users.rust-lang.org/u/system)\
**Post date:** [February 19, 2021, 1:54pm UTC](https://users.rust-lang.org/t/cross-compiling-for-armv8/51737/3 "2021-02-19T13:54:32Z")

</div>

Closed on February 19, 2021, 1:54pm UTC

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.
