Add a new bits/ header to the Android overlay, include runtime libraries that are
auto-extracted and listed many times to the list of libraries to be de-duplicated,
enable a C++ interop test that's working again, and update the doc with new
libraries that need to be available to run a simple executable.
NDK 26 renamed the directory in which it places the Android compiler-rt from
`lib64/`, and added a bunch of nullability annotations to the Bionic libc.
The community CI doesn't have a prebuilt Swift compiler right now, so this
unbreaks the build on there. Also, update the doc with the latest working LTS
NDK and trunk snapshot.
Also, make some related changes, like updating a path in the Android doc, making sure the
`unknown` vendor is always used, and using `CPU` instead of `CODEGENERATOR`.
Also, switch the build instructions in the doc to the much more common AArch64,
add instructions to cross-compile a standalone stdlib with a prebuilt toolchain,
and add missing Concurrency library and its dependencies to the list of Swift
libraries to copy over.
The latest Long Term Support NDK finally removed binutils, including the bfd/gold
linkers and libgcc. This simplifies our Android support, including making lld the
default linker for Android. Disable three reflection tests that now fail, likely
related to issues with swift-reflection-dump and switching to lld.
The latest Long Term Support NDK finally removed binutils, including the bfd/gold
linkers and libgcc. This simplifies our Android support, including making lld the
default linker for Android. Disable three reflection tests that now fail, likely
related to issues with swift-reflection-dump and switching to lld.
Also, add the libatomic dependency for Android armv7, just as on linux.
Since the NDK removes the platforms/ and sysroot/ directories in the latest NDK
22, switch to the unified sysroot in toolchains/llvm/ and take advantage of a
bunch of simplification that's now possible.
Fixes the Android build, and makes some adjustments for Android NDK r13.
* Fix FindICU.cmake to properly set the `SWIFT_${sdk}_ICU_UC` and
`SWIFT_${sdk}_ICU_I18N` values. These were not properly set because
"uc" and "i18n" were lowercase.
* Adapt `add_swift_library` to parse `ICU_UC` and `ICU_I18N` for
private link libraries and use the proper `SWIFT_${sdk}_ICU_*` values.
* NDK r13 removes a subdirectory from the llvm-libc++ includes path.
Adapt to this change, and add a FIXME to address this issue before it
may break again.
* Update the documentation to point to a new libicu download for NDK 13.
When the "--android-deploy-device-path" option was first added,
build products would only be deployed to a connected Android device
if the option was specified. Now, we use `command_upload_stdlib`
to upload every time the Android tests are being run.
As a result, running the test suite for Android without specifying
a deploy path leads to a subtle error, in which the
`command_upload_stdlib` CMake command fails. End users may find this
difficult to debug.
Add a default argument to the deployment path, and check for a valid
path before executing the CMake command.
This adds support for running tests for the stdlib built
for Android, both on the host machine and on an Android device.
The Android variant of Swift may be built and tested using
the following `build-script` invocation:
```
$ utils/build-script \
-R \ # Build in ReleaseAssert mode.
-T \ # Run all tests.
--android \ # Build for Android.
--android-deploy-device-path /data/local/tmp \ # Temporary directory on the device where Android tests are run.
--android-ndk ~/android-ndk-r10e \ # Path to an Android NDK.
--android-ndk-version 21 \
--android-icu-uc ~/libicu-android/armeabi-v7a/libicuuc.so \
--android-icu-uc-include ~/libicu-android/armeabi-v7a/icu/source/common \
--android-icu-i18n ~/libicu-android/armeabi-v7a/libicui18n.so \
--android-icu-i18n-include ~/libicu-android/armeabi-v7a/icu/source/i18n/
```
See docs/Testing.rst for more details.
* Add instructions to symlink the Android linker.
* Make it clear that paths to `android-ndk-r11c` and `libiconv-libicu-android` may be different based on where the user may have downloaded them by prefixing the paths, such as `/path/to/android-ndk-r11c`.
* Link to https://bugs.swift.org/browse/SR-1321 and recommend Ubuntu 15.10 for now.
* Use HTTPS when invoking `git clone`.
https://bugs.swift.org/browse/SR-1264 identified a problem in the documentation: the `--android-icu-uc` and `--android-icu-i18n` are documented in `utils/build-script` as taking the path to *the directory that contains* the `libcicuuc.so` and `libicui18n.so` libraries, not the paths to the libraries themselves. Passing the path to the libraries themselves causes a build error.
Fix the path to prevent people from encountering an error when copying the build script invocation in the docs.
- Update the documentation to reflect that Swift supports (only)
the latest NDK version. Based on what I've heard from Android
developers that use the NDK, this is a reasonable requirement.
- The most recent version of the Android NDK no longer includes a
"4.8" toolchain version. Change the default to "4.9", and update
the paths in the documentation to match.
- The build script option "--android-ndk-version" was misleading.
This parameter actually refers to the Android API level. Swift
currently supports 21 (Android 5.0) and above (although supporting
lower API levels would be desirable).
Until now the best instructions on how to get started with Swift on
Android were in the original pull request. This spruces those up and
places them in the documentation directory.