summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-01-25 08:26:51 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2023-02-16 20:31:39 +0000
commitc11701c2126da47af7e7044d83443d3d6a9f58cc (patch)
tree2960e24d58cf9c0467211665ad917516e7142dd6
parent6bd2da49262c94649bcba8c5760078c4a689acb2 (diff)
android: Switch from GNU binutils to support NDK 23.x, require 21.x
Relevant announcement from revision history for NDK 23 [1]: > * GNU binutils, excluding the GNU Assembler (GAS), has been removed. GAS > will be removed in the next release. If you are building with > -fno-integrated-as, file bugs if anything is preventing you from > removing that flag. Therefore, switch from uses of GNU binutils to the corresponding LLVM tools instead. NDK 20.x doesn't provide `llvm-ranlib` yet, so bump the minimum version to 21.x. Also drop the previous uses of `ANDROID_BINUTILS_PREBUILT_ROOT`, which appear to no longer be relevant by now. commit 4082a18406c18af7b4fcef7bd501c3679c3be56b Date: Wed Nov 22 23:08:06 2017 +0100 android: use unified headers and llvm-c++ STL (x86) with NDK 16 gnustl (and others) are to be removed in future versions of the ndk also bump gradle and build-tools to current versions along with it arm unfortunately crashes with llvm-c++, so keep with gnustl for now/fix that later that introduced one of those uses mentions issues on ARM, but building and running the app at least on my 32-bit ARM device (Samsung Galaxy S4 I9505, LineageOS 17.1/Android 10) didn't show any issues in a quick test with this change in place. Update the Jenkins config to switch from the now no longer supported NDK 20.1.5948944 to 23.2.8568313 for which building and running the app has been tested on devices for all of the four supported architectures with upcoming change Change-Id I9ea714255faf29d50bb5f8e206f13495637da867 "android: Require NDK 23 and use default linker lld" in place on top, s. that one's commit message for more details. Note however that the NDK version will be further updated to use NDK 25 in upcoming change Change-Id Ib8e65f433ee89ff1bc12432722570bf8f9f7ed85 ("android: Support NDK 24.x and 25.x, use NDK 25 for Jenkins"). [1] https://developer.android.com/ndk/downloads/revision_history [2] https://lists.freedesktop.org/archives/libreoffice/2023-January/089878.html Change-Id: I7645f8025d42f0fa384b5bceb31bb4b1c0a44cb5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146118 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r--bridges/Library_cpp_uno.mk1
-rw-r--r--config_host.mk.in1
-rw-r--r--configure.ac43
-rw-r--r--distro-configs/Jenkins/android_common.conf2
-rw-r--r--external/nss/ExternalProject_nss.mk2
5 files changed, 17 insertions, 32 deletions
diff --git a/bridges/Library_cpp_uno.mk b/bridges/Library_cpp_uno.mk
index 56d86c5aaec2..7b10348e83b7 100644
--- a/bridges/Library_cpp_uno.mk
+++ b/bridges/Library_cpp_uno.mk
@@ -217,7 +217,6 @@ endif
# it off.
ifeq ($(COM),GCC)
$(eval $(call gb_Library_add_cxxflags,gcc3_uno,\
- $(if $(filter armeabi-v7a,$(ANDROID_APP_ABI)),-I$(ANDROID_BINUTILS_PREBUILT_ROOT)/lib/gcc/arm-linux-androideabi/4.9.x/include) \
-fno-omit-frame-pointer \
-fno-strict-aliasing \
-fno-lto \
diff --git a/config_host.mk.in b/config_host.mk.in
index 519b472cb2ec..b954ed8b688e 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -19,7 +19,6 @@ export ANDROID_NDK_DIR=@ANDROID_NDK_DIR@
export ANDROID_APP_ABI=@ANDROID_APP_ABI@
export ANDROID_SDK_DIR=@ANDROID_SDK_DIR@
export ANDROID_PACKAGE_NAME=@ANDROID_PACKAGE_NAME@
-export ANDROID_BINUTILS_PREBUILT_ROOT=@ANDROID_BINUTILS_PREBUILT_ROOT@
export ANDROID_GCC_TOOLCHAIN_VERSION=@ANDROID_GCC_TOOLCHAIN_VERSION@
export ANT=@ANT@
export ANT_HOME=@ANT_HOME@
diff --git a/configure.ac b/configure.ac
index ad1caa71cd80..8c52306b04ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -701,16 +701,16 @@ if test -n "$with_android_ndk"; then
fi
case $ANDROID_NDK_VERSION in
r9*|r10*)
- AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
+ AC_MSG_ERROR([Building for Android requires NDK version >= 21.*])
;;
- 11.1.*|12.1.*|13.1.*|14.1.*)
- AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
+ 11.1.*|12.1.*|13.1.*|14.1.*|16.*|17.*|18.*|19.*|20.*)
+ AC_MSG_ERROR([Building for Android requires NDK version >= 21.*])
;;
- 16.*|17.*|18.*|19.*|20.*|21.*|22.*)
+ 21.*|22.*|23.*)
;;
*)
- AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* to 22.* have been used successfully. Proceed at your own risk.])
- add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* to 22.* have been used successfully. Proceed at your own risk."
+ AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 21.* to 23.* have been used successfully. Proceed at your own risk.])
+ add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 21.* to 23.* have been used successfully. Proceed at your own risk."
;;
esac
@@ -719,36 +719,26 @@ if test -n "$with_android_ndk"; then
ANDROID_API_LEVEL="$with_android_api_level"
fi
- android_cpu=$host_cpu
if test $host_cpu = arm; then
- android_platform_prefix=arm-linux-androideabi
- android_gnu_prefix=$android_platform_prefix
LLVM_TRIPLE=armv7a-linux-androideabi
ANDROID_APP_ABI=armeabi-v7a
ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
elif test $host_cpu = aarch64; then
- android_platform_prefix=aarch64-linux-android
- android_gnu_prefix=$android_platform_prefix
- LLVM_TRIPLE=$android_platform_prefix
+ LLVM_TRIPLE=aarch64-linux-android
# minimum android version that supports aarch64
if test "$ANDROID_API_LEVEL" -lt "21" ; then
ANDROID_API_LEVEL=21
fi
ANDROID_APP_ABI=arm64-v8a
elif test $host_cpu = x86_64; then
- android_platform_prefix=x86_64-linux-android
- android_gnu_prefix=$android_platform_prefix
- LLVM_TRIPLE=$android_platform_prefix
+ LLVM_TRIPLE=x86_64-linux-android
# minimum android version that supports x86_64
ANDROID_API_LEVEL=21
ANDROID_APP_ABI=x86_64
else
# host_cpu is something like "i386" or "i686" I guess, NDK uses
# "x86" in some contexts
- android_cpu=x86
- android_platform_prefix=$android_cpu
- android_gnu_prefix=i686-linux-android
- LLVM_TRIPLE=$android_gnu_prefix
+ LLVM_TRIPLE=i686-linux-android
ANDROID_APP_ABI=x86
fi
@@ -782,15 +772,12 @@ if test -n "$with_android_ndk"; then
esac
android_TOOLCHAIN=$ANDROID_NDK_DIR/toolchains/llvm/prebuilt/$android_HOST_TAG
ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
- dnl TODO: NSS build uses it...
- ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_DIR/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
- AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
-
- test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
- test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
- test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
- test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
- test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
+
+ test -z "$AR" && AR=$ANDROID_COMPILER_BIN/llvm-ar
+ test -z "$NM" && NM=$ANDROID_COMPILER_BIN/llvm-nm
+ test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/llvm-objdump
+ test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/llvm-ranlib
+ test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/llvm-strip
ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
diff --git a/distro-configs/Jenkins/android_common.conf b/distro-configs/Jenkins/android_common.conf
index 9c9edec504da..c5489f36c3e4 100644
--- a/distro-configs/Jenkins/android_common.conf
+++ b/distro-configs/Jenkins/android_common.conf
@@ -1,5 +1,5 @@
--with-android-sdk=$HOME/Android/Sdk
---with-android-ndk=$HOME/Android/Sdk/ndk/20.1.5948944
+--with-android-ndk=$HOME/Android/Sdk/ndk/23.2.8568313
--with-jdk-home=/etc/alternatives/java_sdk_11
--enable-android-editing
CC_FOR_BUILD=/opt/rh/devtoolset-7/root/usr/bin/gcc
diff --git a/external/nss/ExternalProject_nss.mk b/external/nss/ExternalProject_nss.mk
index ee3c7839fcb6..165591536de1 100644
--- a/external/nss/ExternalProject_nss.mk
+++ b/external/nss/ExternalProject_nss.mk
@@ -76,7 +76,7 @@ $(call gb_ExternalProject_get_state_target,nss,build): \
COMMA=$(COMMA) \
CC="$(CC)$(if $(filter iOS,$(OS)), -DNSS_STATIC_SOFTOKEN=1 -DNSS_STATIC_FREEBL=1 -DNSS_STATIC_PKCS11=1)$(if $(filter ANDROID,$(OS)), -D_PR_NO_LARGE_FILES=1 -DSQLITE_DISABLE_LFS=1)" CCC="$(CXX)" \
$(if $(CROSS_COMPILING),NSINSTALL="$(if $(filter MACOSX,$(OS_FOR_BUILD)),xcrun python3,$(call gb_ExternalExecutable_get_command,python)) $(SRCDIR)/external/nss/nsinstall.py") \
- $(if $(filter ANDROID,$(OS)),OS_TARGET=Android OS_TARGET_RELEASE=16 ARCHFLAG="" DEFAULT_COMPILER=clang ANDROID_NDK=$(ANDROID_NDK_DIR) ANDROID_TOOLCHAIN_VERSION=$(ANDROID_GCC_TOOLCHAIN_VERSION) ANDROID_PREFIX=$(HOST_PLATFORM) ANDROID_SYSROOT=$(ANDROID_NDK_DIR)/sysroot ANDROID_TOOLCHAIN=$(ANDROID_BINUTILS_PREBUILT_ROOT)) \
+ $(if $(filter ANDROID,$(OS)),OS_TARGET=Android OS_TARGET_RELEASE=16 ARCHFLAG="" DEFAULT_COMPILER=clang ANDROID_NDK=$(ANDROID_NDK_DIR) ANDROID_TOOLCHAIN_VERSION=$(ANDROID_GCC_TOOLCHAIN_VERSION) ANDROID_PREFIX=$(HOST_PLATFORM) ANDROID_SYSROOT=$(ANDROID_NDK_DIR)/sysroot) \
NSS_DISABLE_GTESTS=1 \
nss_build_all \
&& rm -f $(call gb_UnpackedTarball_get_dir,nss)/dist/out/lib/*.a \