From 62c984f0aaf8a04e17969086c16c233f21eba379 Mon Sep 17 00:00:00 2001 From: jerry Date: Thu, 7 Nov 2024 01:44:48 +0000 Subject: [PATCH] [#453] Document how to make cross-compilation work with buildroot --- doc/cross-compile/buildroot.md | 59 ++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/doc/cross-compile/buildroot.md b/doc/cross-compile/buildroot.md index 74e7ec07..5fa420e7 100644 --- a/doc/cross-compile/buildroot.md +++ b/doc/cross-compile/buildroot.md @@ -1,36 +1,39 @@ - -## How to make cross-compilation work with buildroot +# 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: `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh` - -3. add the arm64 target for rust: `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: +2. install the `rust` toolchain: + + ```console + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` + +3. add the arm64 target for Rust: `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: + ```console [target.aarch64-unknown-linux-gnu] linker = "aarch64-buildroot-linux-gnu-gcc" ``` - "aarch64-buildroot-linux-gnu-gcc" is your real cross-compilation tool name - - -6. source your cross-compilation buildroot environment: `source /to/your/environment-setup`, this file should be in your buildroot folder - -7. add the buildroot sysroot on host PC environment: `export BINDGEN_EXTRA_CLANG_ARGS="--sysroot=/to/your/sysroot"` - -8. Change to the iceoryx2 directory - ```console - cd iceoryx2 - ``` -9 ... - -9. cmake -S . -B build -DBUILD_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=../_OUTPUT -DRUST_TARGET_TRIPLET='aarch64-unknown-linux-gnu' - -10. cd build - -11. make -j8 - -12. make install + "aarch64-buildroot-linux-GNU-gcc" is your real cross-compilation tool name +5. source your cross-compilation buildroot environment: + `source /to/your/environment-setup`, this file should be in your buildroot + folder + +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. cmake -S . -B build -DBUILD_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=../\_OUTPUT + -DRUST_TARGET_TRIPLET='aarch64-unknown-linux-GNU' + +9. make -j8 + +10. make install Finally, you can get the arm64 libs, include files in the `_OUTPUT` folder.