-
Notifications
You must be signed in to change notification settings - Fork 10.5k
build: adjust android build path #71927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Remove custom `SWIFT_ANDROID_NDK_PATH` variable for the CMake variable `CMAKE_ANDROID_NDK` which is part of the default CMake tooling. - Adjust the default NDK sysroot to be the NDK sysroot, not the termux sysroot to match the SDK name.
@swift-ci please test |
CC: @etcwilde @finagolfin |
CC: @drodriguez |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am +1 in changing to a variable that CMake understands and might be used for other things. However a simple grepping of the variable name can find a lot of cases that are not dealt with here (the build-script-impl
, the test files, CMake files for libdispatch).
BTW, the Android CI has been broken (and it cannot be launched on demand from a PR) since main
required using Swift Syntax for some pieces of the toolchain.
I can likely go through the tests; I noticed the libdispatch issue locally and need to dig into that. I am running this locally for now. I will be putting up some changes subsequently to start building the Android SDKs on Windows to ensure that we don't regress those builds. |
Yeah, separating termux and Android makes sense since they are different userspaces. |
@swift-ci please test macOS platform |
@@ -1094,8 +1092,9 @@ elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "ANDROID") | |||
set(SWIFT_HOST_VARIANT "android" CACHE STRING | |||
"Deployment OS for Swift host tools (the compiler) [android]") | |||
|
|||
set(SWIFT_ANDROID_NATIVE_SYSROOT "/data/data/com.termux/files" CACHE STRING | |||
"Path to Android sysroot, default initialized to the Termux app's layout") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You misunderstand what this is used for. SWIFT_ANDROID_NATIVE_SYSROOT
is a native sysroot used in Android itself, eg the Termux app that runs on Android has its own native compilation sysroot and does not use the NDK. SWIFT_ANDROID_NDK_PATH
is the path to the NDK and is only set when cross-compiling to Android.
That's why the code in cmake/modules/SwiftAndroidSupport.cmake
below first checks if SWIFT_ANDROID_NDK_PATH
is set, so it knows if it is cross-compiling with the NDK, then checks if natively compiling with an Android sysroot, ie in Termux, and if neither happens to be set, it errors.
Don't modify these two lines: it is not relevant to the normal Android cross-compilation workflow that you are using.
They are already completely separated since I added this
|
I am fine with the medium-term goal of pulling in CMake's built-in support for Android cross-compilation- provided the unrelated changes to
That is not required yet but yours is the only CI disabling it, so every time some issue like #71807 is fixed, new issues crop up, since all the official CI enable using the new swift-syntax parser. |
Building the regular android path was definitely impacted by these changes - I'm happy to leave the removed variable around if it doesn't impact the android build, but we should rename it to reflect that it is for termux and not Android. |
What were you building, were you cross-compiling the Swift compiler itself from Windows to Android? Because unless the
It is for native compilation- not Termux, as there are other native compilation environments on Android- but simply default-initialized to Termux, as Termux is by far the most popular app used for that. The name |
I'm building the runtime only not the compiler. I am cross-compiling from Windows to Android though. |
OK, try removing the |
SWIFT_ANDROID_NDK_PATH
variable for the CMake variableCMAKE_ANDROID_NDK
which is part of the default CMake tooling.