raspberry:cross-platform-compile:cross-compile-overview
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| raspberry:cross-platform-compile:cross-compile-overview [2026/09/02 20:32] – oscar | raspberry:cross-platform-compile:cross-compile-overview [2026/09/04 12:41] (current) – [Cross Platform Development for Raspberry] oscar | ||
|---|---|---|---|
| Line 8: | Line 8: | ||
| - **Different Linux/ | - **Different Linux/ | ||
| - | - [[raspberry: | + | - [[raspberry: |
| - | - [[raspberry: | + | |
| - | [[raspberry: | + | - [[raspberry: |
| + | |||
| + | | ||
| + | |||
| + | - [[raspberry: | ||
| + | |||
| + | |||
| + | ===== Compatibility rule ===== | ||
| + | Build against the oldest operating-system release and CPU that the resulting | ||
| + | binary must support. Do not link a Bookworm target against Trixie ARM libraries. Doing so can create | ||
| + | dependencies on newer glibc or library symbols that are unavailable on the | ||
| + | Bookworm target. For example: | ||
| + | < | ||
| + | Incorrect: | ||
| + | Trixie compiler + Trixie armhf libraries -> Bookworm target | ||
| + | |||
| + | Correct: | ||
| + | Trixie compiler + Bookworm armhf sysroot -> Bookworm target | ||
| + | </ | ||
| ===== The problem with different host and target ARM libraries ===== | ===== The problem with different host and target ARM libraries ===== | ||
| Line 50: | Line 67: | ||
| " | " | ||
| </ | </ | ||
| - | This is one of the most common reasons why **building on a newer distribution for an older target** causes trouble. | + | This is one of the most common reasons why **building on a newer distribution for an older target** causes trouble. It isn't only the **libraries** that matter. The headers matter too. Suppose you compile against Trixie' |
| - | It isn't only the **libraries** that matter. The headers matter too. Suppose you compile against Trixie' | + | |
| * API definitions | * API definitions | ||
| * feature macros | * feature macros | ||
| Line 60: | Line 76: | ||
| * library-specific APIs | * library-specific APIs | ||
| So the ideal relationship is: | So the ideal relationship is: | ||
| - | < | ||
| - | | ||
| - | ┌─────────────────┐ | ||
| - | │ headers | ||
| - | │ libraries | ||
| - | │ linker files │ | ||
| - | │ ABI │ | ||
| - | └────────┬────────┘ | ||
| - | │ | ||
| - | ▼ | ||
| - | cross compiler | ||
| - | │ | ||
| - | ▼ | ||
| - | your executable | ||
| - | </ | ||
| That's why a **target-specific sysroot** is the clean solution. | That's why a **target-specific sysroot** is the clean solution. | ||
| Line 88: | Line 89: | ||
| </ | </ | ||
| The rule is simple: **Don' | The rule is simple: **Don' | ||
| - | |||
| - | ===== Nog uit te zoeken ===== | ||
| - | |||
| - | This distinction matters: | ||
| - | |||
| - | ### Target = Debian armhf | ||
| - | < | ||
| - | Debian Bookworm x86-64 | ||
| - | ↓ | ||
| - | Debian Bookworm armhf | ||
| - | </ | ||
| - | |||
| - | Excellent fit for: crossbuild-essential-armhf | ||
| - | |||
| - | |||
| - | ### Target = Raspberry Pi OS 32-bit | ||
| - | < | ||
| - | Debian Bookworm x86-64 | ||
| - | ↓ | ||
| - | Raspberry Pi OS armhf | ||
| - | </ | ||
| - | |||
| - | You should ideally use the **actual Raspberry Pi OS sysroot/ | ||
| - | This becomes particularly important if you're linking against anything beyond libc. | ||
| - | you want the headers and libraries corresponding to the **actual target system**. Otherwise you can end up with: | ||
| - | |||
| - | < | ||
| - | compile successfully | ||
| - | ↓ | ||
| - | link successfully | ||
| - | ↓ | ||
| - | copy to Pi | ||
| - | ↓ | ||
| - | runtime/ | ||
| - | </ | ||
| - | |||
| ====== Raspberry Pi OS vs Debian armhf ====== | ====== Raspberry Pi OS vs Debian armhf ====== | ||
| - | One important distinction: | + | One important distinction: |
| - | + | target. Use Debian repositories only when the target is Debian armhf. | |
| - | There is, however, a **very important caveat** | + | |
| - | + | ||
| - | If your target is **Raspberry Pi OS 32-bit**, don't blindly assume that Debian | + | |
| - | Debian itself points this out: | + | If your target is **Raspberry Pi OS 32-bit**, don't blindly assume that Debian Bookworm' |
| > Raspberry Pi OS armhf can be subtly incompatible with Debian armhf. | > Raspberry Pi OS armhf can be subtly incompatible with Debian armhf. | ||
raspberry/cross-platform-compile/cross-compile-overview.1788381172.txt.gz · Last modified: by oscar
