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
Update NDK 25 LTS (r25b) #7240
Update NDK 25 LTS (r25b) #7240
Conversation
…` and `_Unwind_GetIP`" This reverts commit e790b25.
PR checklist (remove before merging)
|
@@ -41,51 +36,6 @@ def glob_files(patterns, cwd=None): | |||
os.chdir(oldcwd) | |||
return out | |||
|
|||
# Original from wafadmin/Build.py install_files: | |||
# I couldn't get the original code to work as I needed, so I made a small change to it. | |||
def package_install_files(self, path, files, env=None, chmod=Constants.O644, relative_trick=False, cwd=None): |
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.
new waf doesn't have this function
it is possible to implement it using default waf functionality
@@ -642,7 +642,7 @@ | |||
:path ["android" "version_code"]} | |||
{:type :integer, | |||
:help "minimum API Level required for the application to run (android:minSdkVersion)", | |||
:default 16, |
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.
Minimum android version increased to 19
@@ -20,7 +20,7 @@ def build(bld): | |||
target = 'crashext_null') | |||
|
|||
if 'android' in bld.env['PLATFORM']: | |||
sig_handler = 'backtrace_libunwind.cpp' |
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.
New backtrace unwinder implemented for Android. It uses clang libunwind
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.
ANd, now we have two files using the libunwind library.
I think you need to rename one.
Note that "lib" is implicit for library names. I.e. "libunwind" == "the unwind library"
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.
we use libunwind from NDK on Android and modified libunwind from Google for macos (because it's a bit better and can get symbols from DWARF).
What do you think is the best name backtrace_libunwind_ndk.cpp
?
bld.install_files('${PREFIX}/%s-%s/lib/%s/' % (APPNAME, VERSION, bld.env.PLATFORM), bld.env.cstlib_PATTERN % 'BulletCollision') | ||
bld.install_files('${PREFIX}/%s-%s/lib/%s/' % (APPNAME, VERSION, bld.env.PLATFORM), bld.env.cstlib_PATTERN % 'BulletDynamics') | ||
bld.install_files('${PREFIX}/%s-%s/lib/%s/' % (APPNAME, VERSION, bld.env.PLATFORM), bld.env.cstlib_PATTERN % 'LinearMath') | ||
bld.install_files('${PREFIX}/%s-%s/include' % (APPNAME, VERSION), bld.path.ant_glob(['**/*.h']), cwd=bld.path.find_dir(packagedir), relative_trick=True) |
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.
it works with folders hierarhy this way
@@ -605,7 +605,7 @@ def install_sdk(self): | |||
host = 'darwin' # our packages are still called darwin | |||
|
|||
# Android NDK | |||
download_sdk(self, '%s/%s-%s-x86_64.tar.gz' % (self.package_path, PACKAGES_ANDROID_NDK, host), join(sdkfolder, PACKAGES_ANDROID_NDK)) |
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.
the original file on google's side doesn't use-x86_64
postfix, I removed it on our side as well
@@ -63,7 +62,7 @@ if [ ! -e "${TARGET_PATH}/${ANDROID_NDK_BASENAME}.tar.gz" ]; then | |||
# Cleanup the package, shrinking 2.9GB down to 1.6GB (extracted) | |||
echo "Cleaning NDK" ${TMP}/${ANDROID_NDK} | |||
|
|||
(cd ${TMP} && rm -rf ${ANDROID_NDK}/prebuilt) | |||
# keep: (cd ${TMP} && rm -rf ${ANDROID_NDK}/prebuilt) -- it's easier to rebuild packages using NDKs cmake |
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.
it is a pretty small folder (~7mb), but having it helps to rebuild packages easier
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.
But for those things, we could as easily require the developer to have the NDK installed, and ANDROID_HOME etc setup?
We'll support that soon anyways so that they don't have to create/install this package. So I think that it's still something to think about, since the Docker disc space is still an issue.
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 can do removing of that folder on extender side in Dockerfile then in my PR
ANDROID_NDK_ROOT=${DYNAMO_HOME}/ext/SDKs/android-ndk-r${ANDROID_NDK_VERSION} | ||
|
||
ANDROID_VERSION=16 # Android 4.1 | ||
ANDROID_GCC_VERSION='4.9' |
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.
no more gcc tools in ndk25
;; | ||
|
||
arm64-android) | ||
export LDFLAGS="$LDFLAGS -llog" |
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.
this flag is needed for rebuilding protobuf for android
MANIFEST_MERGE_TOOL: "{{env.MANIFEST_MERGE_TOOL}}" | ||
PATH: "{{env.ANDROID_NDK25_BIN_PATH}}:{{env.PATH}}" | ||
NDK_LD: "{{env.ANDROID_NDK25_BIN_PATH}}/ld.lld" | ||
NDK_CXX: "{{env.ANDROID_NDK25_BIN_PATH}}/armv7a-linux-androideabi{{env.ANDROID_NDK25_API_VERSION}}-clang++" |
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.
Taking into account specific aspects of how ProcessBuilder works, it’s important to use absolute path for the compiler. If a relative path is used, then subprocesses of the compiler are looking for the InstalledDir in PATH variable and may find a wrong one (from another SDK). For the absolute path InstalledDir detects from it.
MANIFEST_MERGE_TOOL: "{{env.MANIFEST_MERGE_TOOL}}" | ||
PATH: "{{env.ANDROID_NDK25_BIN_PATH}}:{{env.PATH}}" | ||
NDK_LD: "{{env.ANDROID_NDK25_BIN_PATH}}/ld.lld" |
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.
To make sure the compiler uses the linker I expected I use absolute path for -fuse-ld
.
It’s not obvious from the official clang documentation that it is possible to use absolute path, but here is a mention about this possibility.
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.
LGTM, only issue is with the name of the new crash handler file.
@@ -872,8 +868,7 @@ def _strip_executable(bld, platform, target_arch, path): | |||
if 'android' in platform: | |||
HOME = os.environ['USERPROFILE' if sys.platform == 'win32' else 'HOME'] | |||
ANDROID_HOST = 'linux' if sys.platform == 'linux' else 'darwin' | |||
build_tool = getAndroidBuildtoolName(target_arch) | |||
strip = "%s/toolchains/%s-%s/prebuilt/%s-x86_64/bin/%s-strip" % (ANDROID_NDK_ROOT, build_tool, ANDROID_GCC_VERSION, ANDROID_HOST, build_tool) | |||
strip = "%s/toolchains/llvm/prebuilt/%s-x86_64/bin/llvm-strip" % (ANDROID_NDK_ROOT, ANDROID_HOST) |
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.
Does the 64 bit strip
nowwork on
armv7` executables?
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 can't find docs for it (it's always isn't so easy) but I tested it and it works
@@ -0,0 +1,172 @@ | |||
// Copyright 2020-2022 The Defold Foundation |
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.
Now it has the same name as the macos version, "libunwind" which is very confusing.
@@ -20,7 +20,7 @@ def build(bld): | |||
target = 'crashext_null') | |||
|
|||
if 'android' in bld.env['PLATFORM']: | |||
sig_handler = 'backtrace_libunwind.cpp' |
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.
ANd, now we have two files using the libunwind library.
I think you need to rename one.
Note that "lib" is implicit for library names. I.e. "libunwind" == "the unwind library"
@@ -63,7 +62,7 @@ if [ ! -e "${TARGET_PATH}/${ANDROID_NDK_BASENAME}.tar.gz" ]; then | |||
# Cleanup the package, shrinking 2.9GB down to 1.6GB (extracted) | |||
echo "Cleaning NDK" ${TMP}/${ANDROID_NDK} | |||
|
|||
(cd ${TMP} && rm -rf ${ANDROID_NDK}/prebuilt) | |||
# keep: (cd ${TMP} && rm -rf ${ANDROID_NDK}/prebuilt) -- it's easier to rebuild packages using NDKs cmake |
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.
But for those things, we could as easily require the developer to have the NDK installed, and ANDROID_HOME etc setup?
We'll support that soon anyways so that they don't have to create/install this package. So I think that it's still something to think about, since the Docker disc space is still an issue.
APP_ABI := arm64-v8a #armeabi-v7a | ||
APP_CXXFLAGS := -std=c++11 -frtti -D__STDC_LIMIT_MACROS -D_THREAD_SAFE | ||
APP_PLATFORM := android-9 | ||
APP_PLATFORM := android-19 |
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.
Is this file even used now that we use the libunwind from the NDK?
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.
no, but I would like to keep it for now, because it will be useful for libunwind**stack**
building
see Libunwind
in https://docs.google.com/document/d/1uguu07VuUvBRQvJ4T_NnrfNl7q8JHZD1LF7IuePkhy4/edit#heading=h.mfeghlxitqk0
@JCash thank you for review! |
# Conflicts: # share/extender/build_input.yml
Defold updated from NDK r20 to NDK r25b - the latesNDK version at the moment.
Now minimum Android version API is 19 (Android 4.4)
Fix #7160