Skip to content

Commit bea76dc

Browse files
authored
chore: update README.md
fix #94
1 parent 35d2dc9 commit bea76dc

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,20 @@ cargo xtask build --release
7474

7575
### Cross-compiling
7676

77-
Let's say you want to cross-compile Kunai for aarch64 using MUSL, so that you have a single static binary at the end.
78-
79-
1. Install the proper target using rustup `rustup install target aarch64-unknown-linux-musl`
80-
2. You need to install an appropriate toolchain to cross-compile to your target on your distribution. When building to a
81-
MUSL target, it may work using `lld` as linker and it works for `aarch64-unknown-linux-musl` target.
82-
3. Specify the target you want to build for in the command line and specify the linker to use.
83-
```
84-
cargo xtask build --release --target aarch64-unknown-linux-musl --linker /usr/bin/lld
85-
```
86-
If using `lld` does not work, you need to find the appropriate linker to use when cross-compiling to the wanted target.
87-
Please dig a bit on the internet for that as I don't know them all, and it also depends on your distribution.
88-
4. You should find your cross-compiled binary at `./target/aarch64-unknown-linux-musl/release/kunai`
77+
#### aarch64
78+
79+
1. Install the proper target using rustup `rustup install target aarch64-unknown-linux-gnu`
80+
2. You need to install appropriate compiler and linker to cross-compile
81+
```bash
82+
# example on ubuntu
83+
sudo apt install gcc-aarch64-linux-gnu
84+
```
85+
4. Cross-compile the project
86+
```bash
87+
# compile the project for with release profile
88+
CC=aarch64-linux-gnu-gcc cargo xbuild --release --target aarch64-unknown-linux-gnu --linker aarch64-linux-gnu-gcc
89+
```
90+
4. You should find your cross-compiled binary at `./target/aarch64-unknown-linux-gnu/release/kunai`
8991

9092
**NB:** specifying `--linker` option is just a shortcut for setting appropriate RUSTFLAGS env variable when building userland
9193
application.

0 commit comments

Comments
 (0)