-
Notifications
You must be signed in to change notification settings - Fork 94
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
android: fix crash with Android <12 and go 1.23 #3243
base: master
Are you sure you want to change the base?
Conversation
Assigned review to @Beerosagos as I can't run simulators so I can't test :( |
externalNativeBuild { | ||
cmake { | ||
path file('src/main/cpp/CMakeLists.txt') | ||
version '3.22.1' |
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.
How did you arrive at this version?
Also you should probably add "cmake;<version>" to the last line of docker_install.sh (and re-build the image and push again)
/opt/android-sdk/cmdline-tools/tools/bin/sdkmanager "ndk;21.2.6472646" "platforms;android-34" "build-tools;34.0.0" "platform-tools"
so that it is available and not downloaded anew every time one enters creates a container.
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 guess the version had to be one of the available ones. It will be clearer if you install it explicitly in docker_install.sh with sdkmanager.
/opt/android-sdk/cmdline-tools/tools/bin/sdkmanager --list | grep cmake
Warning: Errors during XML parse:
Warning: Additionally, the fallback loader failed to parse the XML.
cmake;3.10.2.4988404 | 3.10.2 | CMake 3.10.2.4988404
cmake;3.18.1 | 3.18.1 | CMake 3.18.1
cmake;3.22.1 | 3.22.1 | CMake 3.22.1
cmake;3.30.3 | 3.30.3 | CMake 3.30.3
cmake;3.30.4 | 3.30.4 | CMake 3.30.4
cmake;3.30.5 | 3.30.5 | CMake 3.30.5
cmake;3.31.0 | 3.31.0 | CMake 3.31.0
cmake;3.31.1 | 3.31.1 | CMake 3.31.1
cmake;3.31.4 | 3.31.4 | CMake 3.31.4
cmake;3.31.5 | 3.31.5 | CMake 3.31.5
cmake;3.31.6 | 3.31.6 | CMake 3.31.6
cmake;3.6.4111459 | 3.6.4111459 | CMake 3.6.4111459
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.
How did you arrive at this version?
Whoops can I blame Android Studio? :) I think it makes more sense to use the latest one available
It will be clearer if you install it explicitly in docker_install.sh with sdkmanager.
Will do!
Due to golang/go#70508, the BitBoxApp crashes on versions of Android older than 12 if upgrading to Go 1.23. Therefore we are applying the workaround described at golang/go#70508 (comment) which is to intercept and ignore SIGSYS signals.
@@ -0,0 +1,23 @@ | |||
|
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.
There are a bunch of warnings in CI that would be nice to fix
> Task :app:configureCMakeDebug[arm64-v8a]
C/C++: CMake Warning (dev) in CMakeLists.txt:
C/C++: No project() command is present. The top-level CMakeLists.txt file must
C/C++: contain a literal, direct call to the project() command. Add a line of
C/C++: code such as
C/C++: project(ProjectName)
C/C++: near the top of the file, but after cmake_minimum_required().
C/C++: CMake is pretending there is a "project(Project)" command on the first
C/C++: line.
C/C++: This warning is for project developers. Use -Wno-dev to suppress it.
C/C++: CMake Warning (dev) in CMakeLists.txt:
C/C++: cmake_minimum_required() should be called prior to this top-level project()
C/C++: call. Please see the cmake-commands(7) manual for usage documentation of
C/C++: both commands.
C/C++: This warning is for project developers. Use -Wno-dev to suppress it.
C/C++: CMake Deprecation Warning at /opt/android-sdk/ndk/27.0.12077973/build/cmake/android.toolchain.cmake:35 (cmake_minimum_required):
C/C++: Compatibility with CMake < 3.10 will be removed from a future version of
C/C++: CMake.
C/C++: Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
C/C++: to tell CMake that the project requires at least <min> but has been updated
C/C++: to work with policies introduced by <max> or earlier.
C/C++: Call Stack (most recent call first):
C/C++: /opt/android-sdk/cmake/3.31.6/share/cmake-3.31/Modules/CMakeDetermineSystem.cmake:146 (include)
C/C++: CMakeLists.txt
C/C++: CMake Deprecation Warning at /opt/android-sdk/ndk/27.0.12077973/build/cmake/android-legacy.toolchain.cmake:35 (cmake_minimum_required):
C/C++: Compatibility with CMake < 3.10 will be removed from a future version of
C/C++: CMake.
C/C++: Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
C/C++: to tell CMake that the project requires at least <min> but has been updated
C/C++: to work with policies introduced by <max> or earlier.
C/C++: Call Stack (most recent call first):
C/C++: /opt/android-sdk/ndk/27.0.12077973/build/cmake/android.toolchain.cmake:55 (include)
C/C++: /opt/android-sdk/cmake/3.31.6/share/cmake-3.31/Modules/CMakeDetermineSystem.cmake:146 (include)
C/C++: CMakeLists.txt
C/C++: CMake Deprecation Warning at /opt/android-sdk/ndk/27.0.12077973/build/cmake/android.toolchain.cmake:35 (cmake_minimum_required):
C/C++: Compatibility with CMake < 3.10 will be removed from a future version of
C/C++: CMake.
C/C++: Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
C/C++: to tell CMake that the project requires at least <min> but has been updated
C/C++: to work with policies introduced by <max> or earlier.
C/C++: Call Stack (most recent call first):
C/C++: /root/go/src/github.com/BitBoxSwiss/bitbox-wallet-app/frontends/android/BitBoxApp/app/.cxx/Debug/3j161s34/arm64-v8a/CMakeFiles/3.31.6/CMakeSystem.cmake:6 (include)
C/C++: CMakeLists.txt
C/C++: CMake Deprecation Warning at /opt/android-sdk/ndk/27.0.12077973/build/cmake/android.toolchain.cmake:35 (cmake_minimum_required):
C/C++: Compatibility with CMake < 3.10 will be removed from a future version of
C/C++: CMake.
C/C++: Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
C/C++: to tell CMake that the project requires at least <min> but has been updated
C/C++: to work with policies introduced by <max> or earlier.
C/C++: Call Stack (most recent call first):
C/C++: /root/go/src/github.com/BitBoxSwiss/bitbox-wallet-app/frontends/android/BitBoxApp/app/.cxx/Debug/3j161s34/arm64-v8a/CMakeFiles/3.31.6/CMakeSystem.cmake:6 (include)
C/C++: /root/go/src/github.com/BitBoxSwiss/bitbox-wallet-app/frontends/android/BitBoxApp/app/.cxx/Debug/3j161s34/arm64-v8a/CMakeFiles/CMakeScratch/TryCompile-Mhx4cL/CMakeLists.txt:4 (project)
C/C++: CMake Deprecation Warning at /opt/android-sdk/ndk/27.0.12077973/build/cmake/android-legacy.toolchain.cmake:35 (cmake_minimum_required):
C/C++: Compatibility with CMake < 3.10 will be removed from a future version of
C/C++: CMake.
C/C++: Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
C/C++: to tell CMake that the project requires at least <min> but has been updated
C/C++: to work with policies introduced by <max> or earlier.
C/C++: Call Stack (most recent call first):
C/C++: /opt/android-sdk/ndk/27.0.12077973/build/cmake/android.toolchain.cmake:55 (include)
C/C++: /root/go/src/github.com/BitBoxSwiss/bitbox-wallet-app/frontends/android/BitBoxApp/app/.cxx/Debug/3j161s34/arm64-v8a/CMakeFiles/3.31.6/CMakeSystem.cmake:6 (include)
C/C++: /root/go/src/github.com/BitBoxSwiss/bitbox-wallet-app/frontends/android/BitBoxApp/app/.cxx/Debug/3j161s34/arm64-v8a/CMakeFiles/CMakeScratch/TryCompile-Mhx4cL/CMakeLists.txt:4 (project)
C/C++: CMake Deprecation Warning at /opt/android-sdk/ndk/27.0.12077973/build/cmake/android.toolchain.cmake:35 (cmake_minimum_required):
C/C++: Compatibility with CMake < 3.10 will be removed from a future version of
C/C++: CMake.
C/C++: Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
C/C++: to tell CMake that the project requires at least <min> but has been updated
C/C++: to work with policies introduced by <max> or earlier.
C/C++: Call Stack (most recent call first):
C/C++: /root/go/src/github.com/BitBoxSwiss/bitbox-wallet-app/frontends/android/BitBoxApp/app/.cxx/Debug/3j161s34/arm64-v8a/CMakeFiles/3.31.6/CMakeSystem.cmake:6 (include)
C/C++: /root/go/src/github.com/BitBoxSwiss/bitbox-wallet-app/frontends/android/BitBoxApp/app/.cxx/Debug/3j161s34/arm64-v8a/CMakeFiles/CMakeScratch/TryCompile-3f9Hms/CMakeLists.txt:4 (project)
C/C++: CMake Deprecation Warning at /opt/android-sdk/ndk/27.0.12077973/build/cmake/android-legacy.toolchain.cmake:35 (cmake_minimum_required):
C/C++: Compatibility with CMake < 3.10 will be removed from a future version of
C/C++: CMake.
C/C++: Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
C/C++: to tell CMake that the project requires at least <min> but has been updated
C/C++: to work with policies introduced by <max> or earlier.
C/C++: Call Stack (most recent call first):
C/C++: /opt/android-sdk/ndk/27.0.12077973/build/cmake/android.toolchain.cmake:55 (include)
C/C++: /root/go/src/github.com/BitBoxSwiss/bitbox-wallet-app/frontends/android/BitBoxApp/app/.cxx/Debug/3j161s34/arm64-v8a/CMakeFiles/3.31.6/CMakeSystem.cmake:6 (include)
C/C++: /root/go/src/github.com/BitBoxSwiss/bitbox-wallet-app/frontends/android/BitBoxApp/app/.cxx/Debug/3j161s34/arm64-v8a/CMakeFiles/CMakeScratch/TryCompile-3f9Hms/CMakeLists.txt:4 (project)
C/C++: CMake Deprecation Warning at CMakeLists.txt:3 (cmake_minimum_required):
C/C++: Compatibility with CMake < 3.10 will be removed from a future version of
C/C++: CMake.
C/C++: Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
C/C++: to tell CMake that the project requires at least <min> but has been updated
C/C++: to work with policies introduced by <max> or earlier.
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 fixed the one about "project" but the one about the compatibility with 3.10 seems trickier. It is not directly related to the one I specify in the CMakeLists.txt file, bur rather comes from an auto-generated file
( /opt/go/src/github.com/BitBoxSwiss/bitbox-wallet-app/frontends/android/BitBoxApp/app/.cxx/RelWithDebInfo/4m1d2f1o/x86_64/CMakeFiles/3.31.6/CMakeSystem.cmake)
more specifically this line:
include("/opt/android-sdk/ndk/27.0.12077973/build/cmake/android.toolchain.cmake")
and indeed:
> cat /opt/android-sdk/ndk/27.0.12077973/build/cmake/android.toolchain.cmake | grep minimum
cmake_minimum_required(VERSION 3.6.0)
I checked the newest NDK releases and we'd need to upgrade to ndk 28 to fix this warning. I think it would be better to do it in another PR, wdyt?
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.
Yeah makes sense, thanks
Due to golang/go#70508, the BitBoxApp crashes on versions of Android older than 12 if upgrading to Go 1.23.
Therefore we are applying the workaround described at golang/go#70508 (comment) which is to intercept and ignore SIGSYS signals.
Before asking for reviews, here is a check list of the most common things you might need to consider: