@@ -10,7 +10,7 @@ emulator](https://github.com/finagolfin/swift-android-sdk/blob/main/.github/work
10
10
The CI now builds with both the latest LTS NDK 26 and the last LTS NDK 25c. Now
11
11
that Swift 5.9 supports [ the new experimental SDK bundle
12
12
format] ( https://github.com/apple/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md ) ,
13
- I plan to distribute an Android SDK bundle for NDK 26 sometime this month .
13
+ I plan to distribute an Android SDK bundle for NDK 26 at some point .
14
14
15
15
If you cannot build against NDK 26 and the Swift 5.9.2 SDK because of the newly
16
16
added nullability annotations, use the previous NDK 25c and Swift 5.9 SDK instead,
@@ -20,9 +20,9 @@ compiler with the older Swift 5.9 SDK).
20
20
## Cross-compiling and testing Swift packages with the Android SDK
21
21
22
22
To build with the Swift 5.9.2 SDK, first download [ the latest Android LTS NDK
23
- 26b ] ( https://developer.android.com/ndk/downloads ) and [ Swift 5.9.2
23
+ 26c ] ( https://developer.android.com/ndk/downloads ) and [ Swift 5.9.2
24
24
compiler] ( https://swift.org/download/#releases ) (make sure to install the Swift
25
- compiler's dependencies listed there). Unpack these archives and the SDK.
25
+ compiler's dependencies linked there). Unpack these archives and the SDK.
26
26
27
27
Change the symbolic link at ` swift-5.9.2-android-24-sdk/usr/lib/swift/clang `
28
28
to point to the clang headers that come with your swift compiler, eg
@@ -35,8 +35,8 @@ swift-5.9.2-android-24-sdk/usr/lib/swift/clang
35
35
Next, modify the cross-compilation JSON file ` android-aarch64.json ` in this repo
36
36
similarly:
37
37
38
- 1 . All paths to the NDK should change from ` /home/finagolfin/android-ndk-r26b `
39
- to the path to your NDK, ` /home/yourname/android-ndk-r26b ` .
38
+ 1 . All paths to the NDK should change from ` /home/finagolfin/android-ndk-r26c `
39
+ to the path to your NDK, ` /home/yourname/android-ndk-r26c ` .
40
40
41
41
2 . The path to the compiler should change from ` /home/finagolfin/swift-5.9.2-RELEASE-ubuntu22.04 `
42
42
to the path to your Swift compiler, ` /home/yourname/swift-5.9.2-RELEASE-ubi9 ` .
@@ -146,11 +146,11 @@ dependencies and include them yourself.
146
146
147
147
## Building the Android SDKs from source
148
148
149
- Download the Swift 5.9.2 compiler and Android NDK 26b as above. Check out this
149
+ Download the Swift 5.9.2 compiler and Android NDK 26c as above. Check out this
150
150
repo and run
151
151
` SWIFT_TAG=swift-5.9.2-RELEASE ANDROID_ARCH=aarch64 swift get-packages-and-swift-source.swift `
152
152
to get some prebuilt Android libraries and the Swift source to build the SDK. If
153
- you pass in a different tag like ` swift-DEVELOPMENT-SNAPSHOT-2024-01-08 -a `
153
+ you pass in a different tag like ` swift-DEVELOPMENT-SNAPSHOT-2024-02-29 -a `
154
154
for the latest Swift trunk snapshot and pass in the path to the corresponding
155
155
prebuilt Swift toolchain to ` build-script ` below, you can build a Swift trunk
156
156
SDK too, as seen on the CI.
@@ -168,7 +168,7 @@ are installed, run the following `build-script` command with your local paths
168
168
substituted instead:
169
169
```
170
170
./swift/utils/build-script -RA --skip-build-cmark --build-llvm=0 --android
171
- --android-ndk /home/finagolfin/android-ndk-r26b / --android-arch aarch64 --android-api-level 24
171
+ --android-ndk /home/finagolfin/android-ndk-r26c / --android-arch aarch64 --android-api-level 24
172
172
--build-swift-tools=0 --native-swift-tools-path=/home/finagolfin/swift-5.9.2-RELEASE-ubuntu22.04/usr/bin/
173
173
--native-clang-tools-path=/home/finagolfin/swift-5.9.2-RELEASE-ubuntu22.04/usr/bin/
174
174
--host-cc=/usr/bin/clang-13 --host-cxx=/usr/bin/clang++-13
@@ -188,7 +188,7 @@ Finally, copy `libc++_shared.so` from the NDK and modify the cross-compiled
188
188
` libdispatch.so ` and Swift corelibs to include ` $ORIGIN ` and other relative
189
189
directories in their rpaths:
190
190
```
191
- cp /home/yourname/android-ndk-r26b /toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so swift-release-android-aarch64-24-sdk/usr/lib
191
+ cp /home/yourname/android-ndk-r26c /toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so swift-release-android-aarch64-24-sdk/usr/lib
192
192
patchelf --set-rpath \$ORIGIN/../..:\$ORIGIN swift-release-android-aarch64-24-sdk/usr/lib/swift/android/lib*.so
193
193
```
194
194
0 commit comments