Conversation
Signed-off-by: Phil Wang <wzf0428@gmail.com>
d428f11 to
f3ecbef
Compare
Signed-off-by: Phil Wang <wzf0428@gmail.com>
|
I tried out this branch with NDK r20, but it failed with the following error: Looking at the android_config.cmake and comparing the generated compiler flags with the ones from the NDK’s android.toolchain.cmake file, I think that sysroot was not being set correctly. The following change fixes the compilation for me. diff --git a/android/android_config.cmake b/android/android_config.cmake
index 0ab89ef..f86cbc5 100644
--- a/android/android_config.cmake
+++ b/android/android_config.cmake
@@ -83,14 +83,12 @@ else()
endif()
#NDK_SYSROOT_PATH is used in compiler's '--sysroot' flags
-set(NDK_SYSROOT_PATH "$ENV{ANDROID_NDK}/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_NDK_PLATFORMS_ARCH_SUFFIX}/")
-set(NDK_ISYSROOT_PATH "$ENV{ANDROID_NDK}/sysroot -I$ENV{ANDROID_NDK}/sysroot/usr/include/${ANDROID_NDK_TOOLCHAIN_CROSS_PREFIX}")
-
if(APPLE)
- #TODO: Check whether this path is correct for aarch64 under mac.
set(ANDROID_TOOLCHAIN_PATH "$ENV{ANDROID_NDK}/toolchains/llvm/prebuilt/darwin-x86_64/bin")
+ set(NDK_SYSROOT_PATH "$ENV{ANDROID_NDK}/toolchains/llvm/prebuilt/darwin-x86_64/sysroot")
else()
set(ANDROID_TOOLCHAIN_PATH "$ENV{ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin")
+ set(NDK_SYSROOT_PATH "$ENV{ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/sysroot")
endif()
#change toolchain name according to your configuration
@@ -122,7 +120,6 @@ endif()
#TODO: Fine tune pic and pie flag for executable, share library and static library.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=${NDK_SYSROOT_PATH} -pie")
-string(APPEND CMAKE_C_FLAGS " -isysroot ${NDK_ISYSROOT_PATH}")
# set(CMAKE_ASM_FLAGS "")
add_definitions(-D__ANDROID_API__=${ANDROID_API_LEVEL})
Btw, is there any reason why Ne10 is not using the NDK’s CMake toolchain file as officially recommended? |
hi triplef, |
|
I also see quite a bit of short-comings with the original ANDROID_PLATFORM code. The -pie is an issue with r20 |
Signed-off-by: Phil Wang wzf0428@gmail.com