-
Notifications
You must be signed in to change notification settings - Fork 410
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
Hotfix for NDK r19c #231
base: master
Are you sure you want to change the base?
Hotfix for NDK r19c #231
Conversation
Signed-off-by: Phil Wang <[email protected]>
d428f11
to
f3ecbef
Compare
Signed-off-by: Phil Wang <[email protected]>
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 [email protected]