Cannot build basic Android project
-
I just started a new project from the Qt Quick Application - Swipe preset, using Cmake as my build system, and for Android builds it fails to link with the error
/home/carvac/Qt/5.12.0/android_arm64_v8a/lib/libQt5Quick.so: error adding symbols: File in wrong format
This happens for both arm64_v8a and armeabi_v7a.
I haven't made any modifications to the project at all.
I'm on Ubuntu 18.04. Qt Creator says Java Settings are OK (I have it set to use OpenJDK 8), the Android SDK and NDK are okay (SDK version 26.1.1, NDK version 18.1.5063045).
Can anyone assist?
-
Welcome to the group.
File in wrong format indicates the compiler mismatch for library & your app. Can you check it ?Anything worked before ? -
I've compiled desktop x86 apps just fine before, but this is my first time doing Android development.
The Qt library that it's trying to link is clearly the Arm version.
In the build settings for the project, the CMAKE_C_COMPILER it uses is by default
~/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
.I also tried forcing it to be
~/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-gcc
and that didn't work either.Is that what you need to know, or is there something else?
-
I tried increasing the verbosity of the makefile, and it reveals that it calls the clang++ without specifying what the target architecture should be.
When I run that particular clang++ executable, it reveals that it defaults to building for x86-64.
What can I add to CMakeLists to add the
-target
flag for the compiler?