Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Building Android solution with CMake and QTCreator - cannot parse CMake



  • Hi,
    I try to compile solution using this tutorial:
    martin.rpdev.net - building-android-projects-with-qt-creator-and-cmake

    I can build this project on Windows OS, but there is problem with Android.
    This error occurred while parsing cmake:

    The output was:
    1
    clang++.exe: warning: argument unused during compilation: '-mthumb' [-Wunused-command-line-argument]
    clang++.exe: warning: argument unused during compilation: '-mfpu=vfpv3-d16' [-Wunused-command-line-argument]
    clang++.exe: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument]
    error: unknown target CPU 'armv7-a'
    note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cannonlake, icelake-client, icelake-server, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, x86-64
    
    The output was:
    1
    D:\MinGW\bin\ld.exe: unrecognised emulation mode: i386pep
    Supported emulations: i386pe
    clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
    
    
    Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
    Compiler: D:/NVPACK/android-ndk-r19c/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe 
    Build flags: 
    Id flags:  
    

    Console output:

    D:\NVPACK\android-ndk-r19c\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=armv7-none-linux-androideabi --gcc-toolchain=D:/NVPACK/android-ndk-r19c/toolchains//prebuilt/windows-x86_64 --sysroot=D:/NVPACK/android-ndk-r19c/platforms/android-28/arch-arm  -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -funwind-tables -no-canonical-prefixes -D__ANDROID_API__=28 -fexceptions -frtti  -g  -Wl,--fix-cortex-a8  -Wl,--gc-sections -Wl,-z,nocopyreloc  "CMakeFiles\cmTC_47f49.dir\testCXXCompiler.cxx.o"   -o cmTC_47f49  "D:/NVPACK/android-ndk-r19c/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so" "D:/NVPACK/android-ndk-r19c/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libandroid_support.a" -nostdlib++
        clang++.exe: error: unable to execute command: program not executable
        clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
    

    My configuration:
    NDK 19c
    SDK 21 (I didn;t notice problems using .pro)
    Windows 10
    Qt 5.13.0
    CMake version 3.14.6

    NDK 19c is required, because Google Play Store and QT 5.12>0 don't allow lower versions.

    I changed CMAKE_ANDROID_STL_TYPE:INTERNAL from "gnustl_shared" to "c++_shared", because this is newer NDK with CLang.

    CMake Configuration:
    alt text

    CMake generator:
    alt text

    Sources from tutorial without changes.

    Any idea?



  • Ok, I know why it doesn't work.
    QtCreator 4.9 doesn't support CMake with NDK 18 and higher, 4.10 will...


Log in to reply