Commit d4d9dae
committed
Fix Android aarch64 build: expose posix_spawn via bionic weak symbols
The previous API-28 fix (c6bb70d) was a no-op on the current
dockcross-android-arm64 image and the Android build still failed compiling
mtmd-helper.cpp (vendor/sheredom/subprocess.h -> posix_spawn*).
Root cause: that image is NOT the Google NDK CMake toolchain but a
Debian-style cross-clang (/usr/aarch64-linux-android/bin/clang). It never sets
ANDROID/ANDROID_ABI, so the if(ANDROID_ABI)-guarded
add_compile_definitions(__ANDROID_API__=28) never ran; and it ignores
-DANDROID_PLATFORM=android-28 (CMake flags it as an unused variable). bionic
gates posix_spawn behind __BIONIC_AVAILABILITY_GUARD(28), which tests
__ANDROID_MIN_SDK_VERSION__ (predefined by clang from the target triple) — not
__ANDROID_API__ — so even applying that define would not have helped.
Fix: define __ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__ for the Android build.
That forces __BIONIC_AVAILABILITY_GUARD(api) to 1 for every level (declarations
always visible) and weak-links symbols newer than the baked-in min-SDK, which
resolve at load time on the API-28+ devices the artifact targets. It is never
compiler-predefined, so defining it is clean (no -Wmacro-redefined). It also
subsumes the getifaddrs (API 24) case. Detection no longer relies on
ANDROID_ABI: it uses OS_NAME MATCHES "Android" (CI passes -DOS_NAME=Linux-Android)
and the compiler path, plus ANDROID/ANDROID_ABI for a future NDK switch.
Also drop the inert -DANDROID_PLATFORM=android-28 from both Android jobs (it
only produced an unused-variable warning) and rewrite the CLAUDE.md Android
section to document the real mechanism.
https://claude.ai/code/session_013jKzHGzz97hiY6t7mp3MGr1 parent c8bc1b2 commit d4d9dae
3 files changed
Lines changed: 71 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
54 | 85 | | |
55 | 86 | | |
56 | 87 | | |
| |||
76 | 107 | | |
77 | 108 | | |
78 | 109 | | |
79 | | - | |
| 110 | + | |
80 | 111 | | |
81 | 112 | | |
82 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
58 | 81 | | |
59 | 82 | | |
60 | 83 | | |
| |||
0 commit comments