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

Qt create static library for all architectures



  • Hello. I try build static library for Android (*.a). My pro-file:

    QT -= gui
    
    TEMPLATE = lib
    CONFIG += staticlib
    
    CONFIG += c++11
    
    DEFINES += QT_DEPRECATED_WARNINGS
    
    ANDROID_ABIS = armeabi-v7a arm64-v8a x86 x86_64
    
    SOURCES += \
        untitled3.cpp
    
    HEADERS += \
        untitled3.h
    

    Files untitled3.cpp and untitled3.h very simple. When I build project I get the only one library *.a, but expected get four libs for all architectures: armeabi-v7a arm64-v8a x86 x86_64

    When I build at first, compilation finished with error:

    10:13:57: Running steps for project untitled3...
    10:13:57: Starting: "C:\Qt\Qt5.14.1\5.14.1\android\bin\qmake.exe" C:\Users\range\Documents\untitled3\untitled3.pro -spec android-clang "CONFIG+=debug" "CONFIG+=qml_debug" ANDROID_ABIS="armeabi-v7a arm64-v8a x86 x86_64"
    Info: creating stash file C:\Users\range\Documents\andr_out\.qmake.stash
    WARNING: Targets of builds 'Armeabi-v7a' and 'Arm64-v8a' conflict: libuntitled3.a.
    10:13:57: The process "C:\Qt\Qt5.14.1\5.14.1\android\bin\qmake.exe" exited normally.
    10:13:57: Starting: "C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669\prebuilt\windows-x86_64\bin\make.exe" -f C:/Users/range/Documents/andr_out/Makefile qmake_all
    make: Nothing to be done for 'qmake_all'.
    10:13:57: The process "C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669\prebuilt\windows-x86_64\bin\make.exe" exited normally.
    10:13:57: Starting: "C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669\prebuilt\windows-x86_64\bin\make.exe" -j12
    C:/Users/range/AppData/Local/Android/Sdk/ndk/21.0.6113669/prebuilt/windows-x86_64/bin/make -f Makefile.Armeabi-v7a all
    C:/Users/range/AppData/Local/Android/Sdk/ndk/21.0.6113669/prebuilt/windows-x86_64/bin/make -f Makefile.Arm64-v8a all
    C:/Users/range/AppData/Local/Android/Sdk/ndk/21.0.6113669/prebuilt/windows-x86_64/bin/make -f Makefile.X86 all
    C:/Users/range/AppData/Local/Android/Sdk/ndk/21.0.6113669/prebuilt/windows-x86_64/bin/make -f Makefile.X86_64 all
    make[1]: Entering directory 'C:/Users/range/Documents/andr_out'
    C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++ -c -target armv7a-linux-androideabi21 -fno-limit-debug-info -fPIC -fstack-protector-strong -DANDROID -g -marm -O0 -fPIC -std=gnu++11 -Wall -W -D_REENTRANT -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_CORE_LIB -I..\untitled3 -I. -I..\..\..\..\Qt\Qt5.14.1\5.14.1\android\include -I..\..\..\..\Qt\Qt5.14.1\5.14.1\android\include\QtCore -Iarmeabi-v7a -I..\..\..\..\Qt\Qt5.14.1\5.14.1\android\mkspecs\android-clang -o armeabi-v7a\untitled3.obj ..\untitled3\untitled3.cpp
    make[1]: Entering directory 'C:/Users/range/Documents/andr_out'
    C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++ -c -target aarch64-linux-android21 -fno-limit-debug-info -fPIC -fstack-protector-strong -DANDROID -g -fPIC -std=gnu++11 -Wall -W -D_REENTRANT -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_CORE_LIB -I..\untitled3 -I. -I..\..\..\..\Qt\Qt5.14.1\5.14.1\android\include -I..\..\..\..\Qt\Qt5.14.1\5.14.1\android\include\QtCore -Iarm64-v8a -I..\..\..\..\Qt\Qt5.14.1\5.14.1\android\mkspecs\android-clang -o arm64-v8a\untitled3.obj ..\untitled3\untitled3.cpp
    make[1]: Entering directory 'C:/Users/range/Documents/andr_out'
    C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++ -c -target i686-linux-android21 -mstackrealign -fno-limit-debug-info -fPIC -fstack-protector-strong -DANDROID -g -fPIC -std=gnu++11 -Wall -W -D_REENTRANT -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_CORE_LIB -I..\untitled3 -I. -I..\..\..\..\Qt\Qt5.14.1\5.14.1\android\include -I..\..\..\..\Qt\Qt5.14.1\5.14.1\android\include\QtCore -Ix86 -I..\..\..\..\Qt\Qt5.14.1\5.14.1\android\mkspecs\android-clang -o x86\untitled3.obj ..\untitled3\untitled3.cpp
    make[1]: Entering directory 'C:/Users/range/Documents/andr_out'
    C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++ -c -target x86_64-linux-android21 -fno-limit-debug-info -fPIC -fstack-protector-strong -DANDROID -g -fPIC -std=gnu++11 -Wall -W -D_REENTRANT -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_CORE_LIB -I..\untitled3 -I. -I..\..\..\..\Qt\Qt5.14.1\5.14.1\android\include -I..\..\..\..\Qt\Qt5.14.1\5.14.1\android\include\QtCore -Ix86_64 -I..\..\..\..\Qt\Qt5.14.1\5.14.1\android\mkspecs\android-clang -o x86_64\untitled3.obj ..\untitled3\untitled3.cpp
    del libuntitled3.a
    del libuntitled3.a
    del libuntitled3.a
    del libuntitled3.a
    ЌҐ г¤ Ґвбп ­ ©вЁ C:\Users\range\Documents\andr_out\libuntitled3.a
    C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ar cqs libuntitled3.a arm64-v8a\untitled3.obj
    ЌҐ г¤ Ґвбп ­ ©вЁ C:\Users\range\Documents\andr_out\libuntitled3.a
    ЌҐ г¤ Ґвбп ­ ©вЁ C:\Users\range\Documents\andr_out\libuntitled3.a
    ЌҐ г¤ Ґвбп ­ ©вЁ C:\Users\range\Documents\andr_out\libuntitled3.a
    C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ar cqs libuntitled3.a armeabi-v7a\untitled3.obj
    C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ar cqs libuntitled3.a x86\untitled3.obj
    C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ar cqs libuntitled3.a x86_64\untitled3.obj
    C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android-ranlib libuntitled3.a
    C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/x86_64-linux-android-ranlib libuntitled3.a
    C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android-ranlib: libuntitled3.a: Permission denied
    make[1]: *** [Makefile.Arm64-v8a:67: libuntitled3.a] Error 1
    make: *** [Makefile:62: arm64-v8a-all] Error 2
    make: *** Waiting for unfinished jobs....
    make[1]: Leaving directory 'C:/Users/range/Documents/andr_out'
    C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/i686-linux-android-ranlib libuntitled3.a
    C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ranlib libuntitled3.a
    C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/x86_64-linux-android-ranlib: unable to rename 'libuntitled3.a'; reason: File exists
    make[1]: *** [Makefile.X86_64:67: libuntitled3.a] Error 1
    make[1]: Leaving directory 'C:/Users/range/Documents/andr_out'
    make: *** [Makefile:90: x86_64-all] Error 2
    C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/i686-linux-android-ranlib: unable to rename 'libuntitled3.a'; reason: File exists
    make[1]: *** [Makefile.X86:67: libuntitled3.a] Error 1
    make: *** [Makefile:76: x86-all] Error 2
    make[1]: Leaving directory 'C:/Users/range/Documents/andr_out'
    make[1]: Leaving directory 'C:/Users/range/Documents/andr_out'
    10:13:58: The process "C:\Users\range\AppData\Local\Android\Sdk\ndk\21.0.6113669\prebuilt\windows-x86_64\bin\make.exe" exited with code 2.
    Error while building/deploying project untitled3 (kit: Android for armeabi-v7a,arm64-v8a,x86,x86_64 (Clang Qt 5.14.1 for Android))
    When executing step "Make"
    10:13:58: Elapsed time: 00:01.
    

    When I build at second, compilation finished successfully, but in output dir I find one *.a - lib:
    6543a40d-136b-42c6-a0c4-8a8c3f2b59ab-image.png

    In folders armeabi-v7a arm64-v8a x86 x86_64 exist only *.obj - files, but not exist .a - files.
    My question: how correct build static library (
    .a) for android for all (4) architectures?
    P.S.: Qt version for Android: 5.14.1; Qt Creator version: 4.11.0, based on Qt version: 5.14.0


Log in to reply