summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCsaba Kertesz <csaba.kertesz@gmail.com>2017-06-15 15:18:22 (GMT)
committerCsaba Kertesz <csaba.kertesz@gmail.com>2017-06-15 15:18:22 (GMT)
commit35e6bf5769409ebf02e33b5db80ab73244d14acf (patch)
treeb4fa4e7ca09325f241ddb9c0aec4d41686791fb2
parente50e04bc8b84e80325610393aca94c1537d7f5fd (diff)
Refactor the needed Android NDK workaround without committed object file
-rw-r--r--android/hack/locale.hobin16672 -> 0 bytes
-rw-r--r--kstars/CMakeLists.txt11
2 files changed, 10 insertions, 1 deletions
diff --git a/android/hack/locale.ho b/android/hack/locale.ho
deleted file mode 100644
index 666278b..0000000
--- a/android/hack/locale.ho
+++ /dev/null
Binary files differ
diff --git a/kstars/CMakeLists.txt b/kstars/CMakeLists.txt
index f060a98..79b5e5b 100644
--- a/kstars/CMakeLists.txt
+++ b/kstars/CMakeLists.txt
@@ -1031,7 +1031,16 @@ endif(NOT BUILD_KSTARS_LITE)
if (ANDROID)
add_library(kstars SHARED ${KSTARS_APP_SRCS})
add_dependencies(KStarsLib cfitsio indi nova raw)
- target_link_libraries(kstars KStarsLib ${CMAKE_SOURCE_DIR}/android/hack/locale.ho -lgnustl_static)
+ set(ANDROID_NDK $ENV{ANDROID_NDK})
+ # This hack is needed by a strange NDK bug. Some symbols are missing in locale.o (libc.a) at linking stage. But
+ # if we force-link with a working libc.a from android-24, there will be duplicated symbols, some symbols will
+ # conflict with libandroid_support.a what is also needed.
+ # Workaround: Extract the needed locale.o from libc.a of android-24 and link KStars Lite with it.
+ ADD_CUSTOM_TARGET(extract_locale_o
+ COMMAND ar -xv ${ANDROID_NDK}/platforms/android-24/arch-arm/usr/lib/libc.a locale.o
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
+ ADD_DEPENDENCIES(kstars extract_locale_o)
+ target_link_libraries(kstars KStarsLib ${CMAKE_BINARY_DIR}/locale.o -lgnustl_static)
else ()
add_executable(kstars ${KSTARS_APP_SRCS})
target_link_libraries(kstars KStarsLib)