forked from eclipse-iceoryx/iceoryx2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[eclipse-iceoryx#453] Document how to make cross-compilation work wit…
…h buildroot
- Loading branch information
1 parent
74f6f9e
commit 4ef47c6
Showing
1 changed file
with
41 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,52 @@ | ||
# 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... | ||
|
||
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: | ||
|
||
```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" | ||
``` | ||
"aarch64-buildroot-linux-gnu-gcc" is your real cross-compilation tool name | ||
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: | ||
|
||
|
||
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' | ||
```console | ||
export BINDGEN_EXTRA_CLANG_ARGS="--sysroot=/to/your/sysroot" | ||
``` | ||
|
||
10. cd build | ||
7. Change to the iceoryx2 directory | ||
|
||
11. make -j8 | ||
```console | ||
cd iceoryx2 | ||
``` | ||
|
||
12. make install | ||
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` folder. | ||
Finally, you can get the arm64 libs, include files in the `_OUTPUT` directory. |