Skip to content

Commit 68982f3

Browse files
committed
[#453] Document how to make cross-compilation work with buildroot
1 parent bd11725 commit 68982f3

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

doc/cross-compile/buildroot.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# How to make cross-compilation work with buildroot
2+
3+
1. Install the build dependencies on your host PC, like: cmake, g++, clang...
4+
5+
2. Install the `rust` toolchain:
6+
7+
```console
8+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
9+
```
10+
11+
3. Add the arm64 target for Rust:
12+
13+
```console
14+
rustup target add aarch64-unknown-linux-gnu
15+
```
16+
17+
4. Modify the arm64 target name to suit your cross-compilation tool, need to
18+
create this file `~/.cargo/config.toml`, add the below code,
19+
"aarch64-buildroot-linux-GNU-gcc" which is your real cross-compilation tool
20+
name:
21+
```console
22+
[target.aarch64-unknown-linux-gnu]
23+
linker = "aarch64-buildroot-linux-gnu-gcc"
24+
```
25+
5. Source your cross-compilation buildroot environment:
26+
27+
```console
28+
source /to/your/environment-setup
29+
```
30+
31+
The `environment-setup` file should be in your buildroot directory.
32+
33+
6. Add the buildroot sysroot on host PC environment:
34+
35+
```console
36+
export BINDGEN_EXTRA_CLANG_ARGS="--sysroot=/to/your/sysroot"
37+
```
38+
39+
7. Change to the iceoryx2 directory
40+
41+
```console
42+
cd iceoryx2
43+
```
44+
45+
8. Configure, build and install iceoryx2
46+
```console
47+
cmake -S . -B build -DBUILD_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=../\_OUTPUT -DRUST_TARGET_TRIPLET='aarch64-unknown-linux-GNU'
48+
cmake --build build
49+
cmake --install build
50+
```
51+
52+
Finally, you can get the arm64 libs, include files in the `_OUTPUT` directory.

0 commit comments

Comments
 (0)