Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#453] Document how to make cross-compilation work with buildroot #502

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions doc/cross-compile/buildroot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# How to make cross-compilation work with buildroot

1. Install the build dependencies on your host PC, like: cmake, g++, clang...

2. Install the `rust` toolchain:

```console
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

3. Add the arm64 target for Rust:

```console
rustup target add aarch64-unknown-linux-gnu
```

4. Modify the arm64 target name to suit your cross-compilation tool, need to
create this file `~/.cargo/config.toml`, add the below code,
"aarch64-buildroot-linux-GNU-gcc" which is your real cross-compilation tool
name:
```console
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-buildroot-linux-gnu-gcc"
```
5. Source your cross-compilation buildroot environment:

```console
source /to/your/environment-setup
```

The `environment-setup` file should be in your buildroot directory.

6. Add the buildroot sysroot on host PC environment:

```console
export BINDGEN_EXTRA_CLANG_ARGS="--sysroot=/to/your/sysroot"
```

7. Change to the iceoryx2 directory

```console
cd iceoryx2
```

8. Configure, build and install iceoryx2
```console
cmake -S . -B build -DBUILD_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=../\_OUTPUT -DRUST_TARGET_TRIPLET='aarch64-unknown-linux-GNU'
cmake --build build
cmake --install build
```

Finally, you can get the arm64 libs, include files in the `_OUTPUT` directory.
Loading