Qt 5.15.2 using SAME builtlibs directory for different ABIs
-
I'm trying to build my app using BOTH Armeabi-v7a and Arm64-v8a ABIs; however, I get a failure with the message:
C:\Users\vbonaventura\AppData\Local\Android\Sdk\ndk\21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ranlib: unable to rename '../../../builtlibs/android/libsxe.a'; reason: File exists
When I got and look to see what the generated makefiles (Makefile.Armeabi-v7a and Makefile.Arm64-v8a) are doing I found this:
Which is the EXACT same destination for BOTH and hence the libsxe.a library created there fails since it would need separate libraries for Arm64-v8a and Armeabi-v7a
Any suggestions?
-
I'm trying to build my app using BOTH Armeabi-v7a and Arm64-v8a ABIs; however, I get a failure with the message:
C:\Users\vbonaventura\AppData\Local\Android\Sdk\ndk\21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ranlib: unable to rename '../../../builtlibs/android/libsxe.a'; reason: File exists
When I got and look to see what the generated makefiles (Makefile.Armeabi-v7a and Makefile.Arm64-v8a) are doing I found this:
Which is the EXACT same destination for BOTH and hence the libsxe.a library created there fails since it would need separate libraries for Arm64-v8a and Armeabi-v7a
Any suggestions?
@Vince_SiriusXM Do you do a complete rebuild after switching to another architecture?
-
@Vince_SiriusXM Do you do a complete rebuild after switching to another architecture?
@jsulm Yes definitely rebuilt from scratch! But I think I found my problem in part... in my defines.pri there is a variable LIBPATH which is used in all subsequent library *.pro files to define where their *.a files will output. Hence when building against 2 architectures there will be conflicts with the generated *.a files.
Is there a standard way to handle this with Qt? I see that the demo projects use *.so files for their libraries but I can't imagine I can't use static libraries. My understanding is Qt generates 2 executables for Android when selecting 2 architectures but then combines them into 1.WARNING: Targets of builds 'Armeabi-v7a' and 'Arm64-v8a' conflict: libsxe.a.
-
I'm trying to build my app using BOTH Armeabi-v7a and Arm64-v8a ABIs; however, I get a failure with the message:
C:\Users\vbonaventura\AppData\Local\Android\Sdk\ndk\21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ranlib: unable to rename '../../../builtlibs/android/libsxe.a'; reason: File exists
When I got and look to see what the generated makefiles (Makefile.Armeabi-v7a and Makefile.Arm64-v8a) are doing I found this:
Which is the EXACT same destination for BOTH and hence the libsxe.a library created there fails since it would need separate libraries for Arm64-v8a and Armeabi-v7a
Any suggestions?
@Vince_SiriusXM I'm using
OBJECTS_DIR = generated/$${ANDROID_TARGET_ARCH}/obj
in my qmake based project. To separate the object files. I'm sure there is something similar for cmake.
try:
set(CMAKE_CXX_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/generated/${ANDROID_TARGET_ARCH}/obj)
-
@Vince_SiriusXM I'm using
OBJECTS_DIR = generated/$${ANDROID_TARGET_ARCH}/obj
in my qmake based project. To separate the object files. I'm sure there is something similar for cmake.
try:
set(CMAKE_CXX_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/generated/${ANDROID_TARGET_ARCH}/obj)
@J-Hilk said in Qt 5.15.2 using SAME builtlibs directory for different ABIs:
@Vince_SiriusXM I'm using
OBJECTS_DIR = generated/$${ANDROID_TARGET_ARCH}/obj
in my qmake based project. To separate the object files. I'm sure there is something similar for cmake.
try:
set(CMAKE_CXX_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/generated/${ANDROID_TARGET_ARCH}/obj)
I am not using cmake, I'm using qmake as per QT5.15.2. Thank you for response!
What file did you add this command to? I assume your project's *.pro file? -
@J-Hilk said in Qt 5.15.2 using SAME builtlibs directory for different ABIs:
@Vince_SiriusXM I'm using
OBJECTS_DIR = generated/$${ANDROID_TARGET_ARCH}/obj
in my qmake based project. To separate the object files. I'm sure there is something similar for cmake.
try:
set(CMAKE_CXX_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/generated/${ANDROID_TARGET_ARCH}/obj)
I am not using cmake, I'm using qmake as per QT5.15.2. Thank you for response!
What file did you add this command to? I assume your project's *.pro file?@Vince_SiriusXM
yes, I have a static library that results in conflicts when compiling for different apks and I found this solution. Haven't had a Problem with it since then.
Android section of the pro file:android { # Android Version code, needs to be upped by 1! ITERATION=24 ANDROID_VERSION_CODE = $$ITERATION QT += androidextras OBJECTS_DIR = generated/$${ANDROID_TARGET_ARCH}/obj .... LIBS += -L$$OUT_PWD/Dependencies/ThCommunication/ -lThCommunication_$${ANDROID_TARGET_ARCH} PRE_TARGETDEPS += $$OUT_PWD/Dependencies/ThCommunication/libThCommunication_$${ANDROID_TARGET_ARCH}.a .... }
-
Hi everyone,
I am getting crazy when trying to generate a multi-ABI apk based on a Qt 5.15.2 application, and perhaps this thread may reach someone who faced the same nightmare :-)
TL;DR: I can successfully generate apk for armeabi-v7a and apk for arm64-v8a. Can launch these apks in devices supporting the corresponding architectures with no problem. But I would prefer my ci/cd pipeline to output a single "universal" .apk containing the necessary files of both architectures so that a app can run in a device supporting only armeabi-v7a or in a device supporting only arm64-v8a.
When calling,
qmake app.pro -spec android-clang CONFIG+=qtquickcompiler ANDROID_ABIS="arm64-v8a armeabi-v7a"
the generated android-app-deployment-settings.json has the following content
{
"description": "This file is generated by qmake to be read by androiddeployqt and should not be modified by hand.",
"qt": "/home/lin-deploy/Qt/5.15.2/android",
"sdk": "/home/lin-deploy/Android/Sdk",
"sdkBuildToolsRevision": "35.0.0",
"ndk": "/home/lin-deploy/Android/Sdk/ndk/21.3.6528147",
"toolchain-prefix": "llvm",
"tool-prefix": "llvm",
"ndk-host": "linux-x86_64",
"architectures": {"arm64-v8a":"aarch64-linux-android", "armeabi-v7a":"arm-linux-androideabi"},
"android-extra-plugins": "/home/lin-deploy/Desktop/deploy/1368/android/plugins/5.15.2/arm64-v8a/plugins",
"android-package-source-directory": "/home/lin-deploy/Desktop/deploy/1368/android/app",
"android-min-sdk-version": "21",
"android-target-sdk-version": "28",
"android-extra-libs": "/home/lin-deploy/Desktop/deploy/1368/lib/cryptopp/crypto/bin/android/arm64-v8a/libcrypto.so,/home/lin-deploy/Desktop/deploy/1368/lib/cryptopp/crypto/bin/android/arm64-v8a/libcryptopp_arm64-v8a.so,/home/lin-deploy/Desktop/deploy/1368/lib/cryptopp/crypto/bin/android/arm64-v8a/libssl.so,/home/lin-deploy/Desktop/deploy/1368/lib/Qt5Psql/5.15.2/arm64-v8a/libpq.so,/home/lin-deploy/Desktop/deploy/1368/lib/libssh/bin/android/arm64-v8a/libssh.so",
"qml-root-path": "/home/lin-deploy/Desktop/deploy/1368",
"stdcpp-path": "/home/lin-deploy/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/",
"qrcFiles": "/home/lin-deploy/Desktop/deploy/1368/res/resources2.qrc,/home/lin-deploy/Desktop/deploy/1368/res/resources.qrc,/home/lin-deploy/Desktop/deploy/buildApp/app_ui_libs_libs_qmlcache.qrc,/home/lin-deploy/Desktop/deploy/1368/app/ui/fonts/fonts.qrc,/home/lin-deploy/Desktop/deploy/1368/app/ui/images/images.qrc,/home/lin-deploy/Desktop/deploy/buildPocket/app_ui_qml_app_qmlcache.qrc,/home/lin-deploy/Desktop/deploy/1368/app/ui/libs/libs.qrc,/home/lin-deploy/Desktop/deploy/1368/pocket/ui/qml/app.qrc",
"application-binary": "App"
}after calling make to build, the two targets (armeabi-v7a and arm64-v8a) get built successfully. But due to the lack of armeabi-v7a versions of android-extra-libs in the above mentioned .json file, when executing androiddeployqt, the resulting .apk seems to work only on devices supporting arm64-v8a.
I forced already the inclusion of abiFilters in defaultConfig block of my build.gradle file with no effect
defaultConfig { resConfig "en" minSdkVersion = qtMinSdkVersion targetSdkVersion = qtTargetSdkVersion ndk{ abiFilters "arm64-v8a", "armeabi-v7a" } }
I am defining explicitly the additional libraries that must be deployed per architecture i.e.
equals(QT_ARCH, "armeabi-v7a") { ANDROID_EXTRA_LIBS = blabla_armeabi-v7a.so ANDROID_EXTRA_PLUGINS += $$_PRO_FILE_PWD_/android/plugins/$$QT_VERSION/armeabi-v7a/plugins } equals(QT_ARCH, "arm64-v8a") { ANDROID_EXTRA_LIBS = blabla_arm64-v8a.so ANDROID_EXTRA_PLUGINS += $$_PRO_FILE_PWD_/android/plugins/$$QT_VERSION/arm64-v8a/plugins }
This approach is working perfectly when deploying separate apks for each architecture, but no matter what I do it looks like arm64-v8a overrides everything in the process of generating the android-app-deployment-settings.json. I even swapped the order of the ABIS in the qmake call (arm64-v8a followed by armeabi-v7a) in order to test this possibility, but the resulting .json file would list arm64-v8a extra libs and plugins only.
Did anyone successfully build AND DEPLOY a multi-abi apk using Qt 5.15.2? Any recomendation on how to tweak the .json so that androiddeployqt can make sense of it and generate the expected multi-abi apk with appropriate libs hierarchy and AndroidManifest?
Thank you so much!