Skip to content

Commit 4aef662

Browse files
committed
website docs on targets
1 parent f01f424 commit 4aef662

1 file changed

Lines changed: 59 additions & 2 deletions

File tree

docs/python-advanced.md

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ build_config.with_build_mode(
9999
og.config.BuildConfiguration.RELEASE_MODE)
100100
```
101101

102+
### Cross-compilation
103+
102104
You can either compile for your own system, or cross-compile for a
103-
different target system. For example, to cross-compile for a Raspberry Pi,
105+
different target system. For example, to cross-compile for a **Raspberry Pi**,
104106
set the following option
105107

106108
```python
@@ -113,8 +115,63 @@ or
113115
build_config.with_target_system("rpi") # Raspberry Pi
114116
```
115117

116-
Note that you need to install the necessary target first.
118+
Note that you need to install the necessary target first.
119+
120+
<details>
121+
<summary><b>See setup details</b></summary>
122+
To cross-compile for a Raspberry Pi you need to run the following in your terminal
123+
124+
```bash
125+
rustup target add arm-unknown-linux-gnueabihf
126+
```
127+
128+
On Linux you also need the following dependencies
129+
130+
```bash
131+
sudo apt-get update
132+
sudo apt-get install -y gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
133+
```
134+
135+
On MacOS, do the following
136+
137+
```bash
138+
# Tap the repository that provides the cross-compiler
139+
brew tap messense/macos-cross-toolchains
140+
# Update brew to ensure the tap is recognized (can sometimes be needed)
141+
brew update
142+
# Install the full toolchain (includes gcc, binutils, sysroot)
143+
# This specific formula provides the entire toolchain.
144+
brew install arm-unknown-linux-gnueabihf
145+
146+
# Verify the compiler is found
147+
which arm-linux-gnueabihf-gcc || (echo "arm-linux-gnueabihf-gcc not found in PATH" && exit 1)
148+
```
149+
</details>
150+
151+
If you need to compile for a target other than `arm-linux-gnueabihf-gcc` (`rpi`)
152+
some manual configuration may be needed (you may need to install the target
153+
and/or a compiler/linker) and you may need to edit the auto-generated
154+
`.cargo/config.toml` files you will find in your auto-generated solvers.
155+
156+
<details>
157+
<summary><b>Non-supported targets</b></summary>
158+
The auto-generated `.cargo/config.toml` files contain entries like
159+
160+
```toml
161+
[target.arm-unknown-linux-gnueabihf]
162+
linker="arm-linux-gnueabihf-gcc"
163+
```
164+
165+
Here you may have to insert manually your own target.
166+
Feel free to open an [issue](https://github.com/alphaville/optimization-engine/issues)
167+
on GitHub if you would like us to add support for a particular target (create a feature
168+
request); see the [contributing guidelines](https://alphaville.github.io/optimization-engine/docs/contributing).
169+
</details>
170+
171+
172+
### Other build options
117173

174+
All build options are shown below
118175

119176
| Method | Explanation |
120177
|-------------------------------|---------------------------------------------|

0 commit comments

Comments
 (0)