summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-01-25 08:27:04 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2023-02-16 20:31:54 +0000
commit7bdc09ffa44e85544d38131702c4264f006c039d (patch)
treea7dcb639da4079854bb384b96a5188ad982853b9 /android
parentc11701c2126da47af7e7044d83443d3d6a9f58cc (diff)
android: Require NDK 23 and use default linker lld
Using lld instead of hard-coding ld.gold speeds up linking liblo-native-code.so from about 40 seconds to about 10 seconds for my x86 debug Android build with NDK 23.2.8568313. lld was added in NDK 21, made default in NDK 22 [1]. lld doesn't know the `--no-keep-files-mapped` option, so drop that as well. ld.gold had previously been hard-coded in commit c6dadf5035c8e1c31dbd3fccec167bd4a906bf54 Date: Fri Nov 1 17:57:17 2019 +0100 android: Fix linking of liblo-native-code.so on aarch64. , but lld wasn't available yet back then. To make sure that lld is used by default, NDK >= 22 has to be used. In addition, due to a clang bug in NDK 22.1.7171670 [2] ("Misspelled -fnostack-clash-protection"), building for aarch64 Android with that NDK version would fail as follows: clang++: error: unknown argument '-fno-stack-clash-protection'; did you mean '-fnostack-clash-protection'? clang++ version: $ /home/michael.weghorn/Android/Sdk/ndk/22.1.7171670//toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --version Android (7155654, based on r399163b1) clang version 11.0.5 (https://android.googlesource.com/toolchain/llvm-project 87f1315dfbea7c137aa2e6d362dbb457e388158d) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /home/michael.weghorn/Android/Sdk/ndk/22.1.7171670//toolchains/llvm/prebuilt/linux-x86_64/bin Rather than work around that bug on LO side, require NDK 23.x right away, since that provides a clang where this is fixed. Both, non-debug as well as `--enable-dbgutil` builds with NDK version 23.2.8568313 were successfully tested for all 4 supported architectures and these devices: * aarch64: Fairphone 3 Plus, LineageOS 19 (Android 12), API 31 * arm32: Samsung Galaxy S4 I9505, LineageOS 17.1 (Android 10), API 29 * x86: * AVD: Nexus 4, API 16 * AVD: Pixel 2, API 30 * x86_64: AVD: Pixel 2, API 33 [1] https://developer.android.com/ndk/downloads/revision_history [2] https://bugs.llvm.org/show_bug.cgi?id=47139 Change-Id: I9ea714255faf29d50bb5f8e206f13495637da867 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146119 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'android')
-rw-r--r--android/Bootstrap/Makefile.shared2
1 files changed, 1 insertions, 1 deletions
diff --git a/android/Bootstrap/Makefile.shared b/android/Bootstrap/Makefile.shared
index f9825b583c05..de7351f5e3f8 100644
--- a/android/Bootstrap/Makefile.shared
+++ b/android/Bootstrap/Makefile.shared
@@ -60,7 +60,7 @@ WHOLELIBS = \
$(OBJLOCAL)/liblo-native-code.so : native-code.cxx $(ALL_STATIC_LIBS)
@echo "Linking $@"
mkdir -p $(OBJLOCAL)
- $(CXX) -fuse-ld=gold -Wl,--build-id=sha1 -Wl,--gc-sections -Wl,--version-script=../Bootstrap/version.map -Wl,--no-keep-files-mapped -Wl,--no-undefined -DANDROID -DDISABLE_DYNLOADING -shared -Wl,-soname,liblo-native-code.so -o $(OBJLOCAL)/liblo-native-code.so -I$(BUILDDIR)/config_host -I$(SRCDIR)/include native-code.cxx -L$(INSTDIR)/$(LIBO_LIB_FOLDER) $(WHOLELIBS) $(LIBS) -lc++_static -lc++abi $(if $(filter-out arm64-v8a x86_64,$(ANDROID_APP_ABI)),-landroid_support) $(if $(filter armeabi-v7a,$(ANDROID_APP_ABI)),-lunwind) $(addprefix -l,$(NSSLIBS)) -lGLESv2 -landroid -ljnigraphics -llog -lz
+ $(CXX) -Wl,--build-id=sha1 -Wl,--gc-sections -Wl,--version-script=../Bootstrap/version.map -Wl,--no-undefined -DANDROID -DDISABLE_DYNLOADING -shared -Wl,-soname,liblo-native-code.so -o $(OBJLOCAL)/liblo-native-code.so -I$(BUILDDIR)/config_host -I$(SRCDIR)/include native-code.cxx -L$(INSTDIR)/$(LIBO_LIB_FOLDER) $(WHOLELIBS) $(LIBS) -lc++_static -lc++abi $(if $(filter-out arm64-v8a x86_64,$(ANDROID_APP_ABI)),-landroid_support) $(if $(filter armeabi-v7a,$(ANDROID_APP_ABI)),-lunwind) $(addprefix -l,$(NSSLIBS)) -lGLESv2 -landroid -ljnigraphics -llog -lz
$(SODEST)/liblo-native-code.so : $(OBJLOCAL)/liblo-native-code.so
mkdir -p $(SODEST)