-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Add support for compiling for Android with ndk r22+ #44055
Comments
The Android NDK breaks compat every other release... Does it offer any stable way to locate relevant paths instead of us having to hardcore them just to see them break whenever upstream decides to move files around? |
I'm not sure what the answer to that question is but NDK provides a CMake file for compiling using the android toolchain, it can be found at |
Reading from the description and comments there are two highlighted issues:
|
Since issue 1 is being handled by #44949, I'm updating this bug's title to reflect the remaining work. |
Follow up information - The changelog for r22 provides a build system maintainers guide to assist with handling migration away from the deprecated directories. |
Godot version:
Godot 3.2.3-stable but affects other godot versions including latest master
OS/device including version:
Windows 10 x64 but impacts other platforms. I can confirm NDK package for linux and macos have also changed.
Issue description:
Currently, when attempting to build godot for android (any arch) the build will fail because it cannot find a header file:
This is because the
sysroot
directory in ndk 22+ has moved from the top level to the toolchain directory, e.g.$ANDROID_NDK_ROOT/sysroot/
$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/windows-x86_64/sysroot/
$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/sysroot/
$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/darwin-x86_64/sysroot
Additionally, the platform libs have also moved
$ANDROID_NDK_ROOT/platform/android-$API_NUM/$ARCH/usr/lib
$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/windows-x86_64/usr/lib/$ABI/$API_NUM/
Currently it appears NDK 22 is in beta so not sure what timeline is on this. However it's worth noting that this occurred on my system because Android Studio installed the beta when I installed the NDK from there.
Steps to reproduce:
ANDROID_NDK_ROOT
to that directoryscons platform=android target=release android_arch=armv7
Partial Solution
A possible fix for the
sysroot
problem is to do version detection for NDK 22+ and adjust the values inplatform/android/detect.py
, e.g.Modifying
godot/platform/android/detect.py
Line 225 in 2a0de6d
This works except it causes a new error:
It looks like it requires more work to adapt the the toolchain changes but I was not able to a final solution. Reverting back to 21.3.6528147 fixes the issue.
The text was updated successfully, but these errors were encountered: