1

I need to build a Qt application for an Android arm64-v8a device.

Those devices are supposed to able to run a armv7a binaries supported by QtCreator (see Is arm64-v8a compatible with armeabi-v7a?). But I'm getting a crash with my app on a arm64-v8a while it works on a armeabi-v7a, so I'd like to build my app directly for arm64-v8a and test again.

After some searchs, I ended up trying to configure Qt (qt-everywhere-5-7) using this command:

I'm working on Windows 7.

configure -xplatform android-g++ -debug-and-release -no-icu -no-wmf-backend -no-compile-examples -opengl desktop -nomake tests -nomake example -android-ndk B:\Android\android-ndk-r11b -android-sdk B:\Android\adt-bundle-windows-x86_64-20131030\sdk -android-arch arm64-v8a -android-ndk-host arm64-v8a -android-toolchain-version 4.9 -no-warnings-are-errors -platform win32-g++

I added mingw530_32 (the one installed and used by QtCreator 4.0.3/Qt5.7) to my path.

Then I get this error:

process_begin: CreateProcess(NULL, B:\Android\android-ndk-r11b/toolchains/aarch64-linux-android-4.9/prebuilt/arm64-v8a/bin/aarch64-linux-android-g++ -c -ffunction-sections -funwind-tables -fstack-protector -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300
 -DANDROID -Wa,--noexecstack -std=c++11 -g -g -fno-omit-frame-pointer -Wall -Wno-psabi -W -fPIC -I. -isystem B:\Android\android-ndk-r11b\sou
rces\cxx-stl\gnu-libstdc++\4.9\include -isystem B:\Android\android-ndk-r11b\sources\cxx-stl\gnu-libstdc++\4.9\libs\arm64-v8a\include -isyste
m B:\Android\android-ndk-r11b\platforms\android-21\arch-arm64\usr\include -IB:\Qt\qt_everywhere\5.7.0\qt-everywhere-opensource-src-5.7.0\qtb
ase\mkspecs\android-g++ -o arch.obj arch.cpp, ...) failed.
make (e=2): Le fichier spÚcifiÚ est introuvable.
mingw32-make: *** [arch.obj] Error 2
Could not find output file 'libarch.so' or 'arch' in B:/Qt/qt_everywhere/5.7.0/qt-everywhere-opensource-src-5.7.0/qtbase/config.tests/arch :
 No such file or directory
ERROR: Qt requires a C++11 compiler and yours does not seem to be that.
Please upgrade.

B:\Android\android-ndk-r11b/toolchains/aarch64-linux-android-4.9/prebuilt/does not have a arm64-v8a folder, only windows-x86_64 is present...but I can't figure out which option I should modify to have Qt scripts pickup this one...

Note:

  • tried to replace -android-ndk-host arm64-v8a by -android-ndk-host windows-x86_64 and got the error Impossible de trouver B:\Qt\qt_everywhere\5.7.0\qt-everywhere-opensource-src-5.7.0\qtbase\config.tests\arch\*~
Community
  • 1
  • 1
jpo38
  • 20,821
  • 10
  • 70
  • 151

1 Answers1

1

the android NDK host argument refers to the host platform, so that is windows-x86_64, as you say. Use the -android-arch argument to specify the target CPU architecture.

Make sure you clean out any left over build artifacts before reconfiguring. Also make sure that Cygwin is not in your PATH, as this will mess up the build. To check, try running "where sh.exe" on the command line. I think the second error you are seeing could be due to this.

Also, "-opengl desktop" does not make any sense since you are not compiling for desktop. I don't think it will do any harm, though.

Here is more information on cross-compiling Qt for Android: http://wiki.qt.io/Android

Please note: Make sure you use Android NDK r10e since the gcc in subsequent releases have severe bugs that will cause all applications to crash.

Here is more information on known issues with Qt for Android: https://wiki.qt.io/Qt_for_Android_known_issues


Edit from jpo38: Actually openGL option leads to a compilation problem. Also had to disable qtdeclarative. Final working configuration command is

configure -xplatform android-g++ -debug-and-release -no-icu -no-wmf-backend -no-compile-examples -android-ndk B:\Android\android-ndk-r11b -android-sdk B:\Android\adt-bundle-windows-x86_64-20131030\sdk -android-ndk-host windows-x86_64 -android-toolchain-version 4.9 -no-warnings-are-errors -platform win32-g++ -android-arch arm64-v8a -skip qtdeclarative

Then Qt compiled all .so files. Did not try to run any program with them yet....

jpo38
  • 20,821
  • 10
  • 70
  • 151
Eskil
  • 86
  • 3
  • Replaced `-android-ndk-host arm64-v8a` by `-android-ndk-host windows-x86_64` from a freshly extracted qt-everywhere folder as suggested, and it worked (still got `B:\Qt\qt_everywhere\5.7.0\qt-everywhere-opensource-src-5.7.0\qtbase\config.tests\arch\*~` but apparently harmless). It's now compiling, I'm crossing my fingers ;-) – jpo38 Oct 03 '16 at 08:49
  • Compiled, with minor changes in the command line. Edited your post. Thanks again fro help and the good work with Qt support! – jpo38 Oct 04 '16 at 13:13