-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add support for building swift host libraries and tools for android host #23742
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
…ctories add_sourcekit_default_compiler_flags was invoking _add_variant_link_flags and getting link flags but not actually using the link_libraries or library_search_directories. In android builds, this means that the correct libc++ is not being linked against.
…ectories The CMake variables ${sdk} and ${arch} are only set if _add_variant_link_flags is invoked from add_swift_target_library calling _add_swift_library_single. If you get to _add_swift_library_single from add_swift_host_library, those variables will not be set and subsequent linking will not find ICU libraries. This was an issue when building swift host libraries on Android.
CMakeLists.txt
Outdated
@@ -746,7 +757,9 @@ endif() | |||
|
|||
# Should we cross-compile the standard library for Android? | |||
is_sdk_requested(ANDROID swift_build_android) | |||
if(swift_build_android AND NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "") | |||
if(swift_build_android | |||
AND NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "" |
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 think it would be nicer if we sink the if (NOT ${SWIFT_ANDROID_NDK_PATH} STREQUAL "")
into the case, as an always thing.
if(swift_build_android AND NOT ${SWIFT_HOST_VARIANT_SDK} STREQUAL ANDROID)
if("${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
message(FATAL_ERROR "SWIFT_ANDROID_NDK_PATH must be set to the Android NDK path")
endif()
@@ -467,12 +467,14 @@ function(_add_variant_link_flags) | |||
endif() | |||
|
|||
if(NOT "${SWIFT_${LFLAGS_SDK}_${LFLAGS_ARCH}_ICU_UC}" STREQUAL "") | |||
get_filename_component(SWIFT_${sdk}_${arch}_ICU_UC_LIBDIR "${SWIFT_${sdk}_${arch}_ICU_UC}" DIRECTORY) | |||
list(APPEND library_search_directories "${SWIFT_${sdk}_${arch}_ICU_UC_LIBDIR}") | |||
get_filename_component(SWIFT_${LFLAGS_SDK}_${LFLAGS_ARCH}_ICU_UC_LIBDIR |
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.
WTF???!!!
@swift-ci please test |
8a28136
to
822eeb6
Compare
Build failed |
@swift-ci please smoke test and merge |
Umm, why was this merged when there's a more comprehensive Android pull, #23208, that's been waiting for weeks now? |
@buttaface: I will answer you in the other thread. |
I'd like to be able to build android host tools and libraries on android.
cc @compnerd @drodriguez