File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -74,18 +74,20 @@ cargo xtask build --release
74
74
75
75
### Cross-compiling
76
76
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 `
89
91
90
92
** NB:** specifying ` --linker ` option is just a shortcut for setting appropriate RUSTFLAGS env variable when building userland
91
93
application.
You can’t perform that action at this time.
0 commit comments