-
Notifications
You must be signed in to change notification settings - Fork 137
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
README: add cross-compile #607
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,6 +190,51 @@ ctest --test-dir build -j | |
|
||
For more detailed build instructions please refer to the [dedicated section on CMake](./docs/1-user-guide/build-with-cmake) or to [our web page][build_info_url]. | ||
|
||
## How to CROSS-COMPILE SLEEF | ||
Two methods are used for cross-compiling SLEEF. Here are examples of cross-compiling SLEEF for the arm architecture on a platform with X86 architecture and Linux OS: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AArch64 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. say x86_64 |
||
|
||
### Method 1 | ||
1. First, compile the native SLEEF. | ||
```bash | ||
cmake -S . -B build-native | ||
|
||
cmake --build build-native -j --clean-first | ||
``` | ||
|
||
2. Cross-compile the target platform's SLEEF. | ||
```bash | ||
cmake -DCMAKE_TOOLCHAIN_FILE=./toolchains/aarch64-gcc.cmake -DNATIVE_BUILD_DIR=$(pwd)/build-native/ -S . -B build | ||
|
||
cmake --build build -j --clean-first | ||
``` | ||
|
||
### Method 2 | ||
|
||
No need to compile the native SLEEF | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add "If running via an emulator like QEMU there is ..." |
||
|
||
1. Install qemu on Ubuntu. | ||
```bash | ||
sudo apt install -y qemu-user-static binfmt-support | ||
``` | ||
|
||
2. Set the environment variable. | ||
```bash | ||
export SLEEF_TARGET_EXEC_USE_QEMU=ON | ||
``` | ||
|
||
3. Set the dynamic linker/loader path. | ||
```bash | ||
# for aarch64 | ||
export QEMU_LD_PREFIX=/usr/aarch64-linux-gnu/ | ||
``` | ||
|
||
4. Cross-compile the target platform's SLEEF. | ||
```bash | ||
cmake -DCMAKE_TOOLCHAIN_FILE=./toolchains/aarch64-gcc.cmake -S . -B build | ||
|
||
cmake --build build -j --clean-first | ||
``` | ||
|
||
## Install SLEEF | ||
|
||
### From source | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add that both rely on existing toolchain files provided in the
toolchains/
directory.