Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QT android static linking issue
Forum Updated to NodeBB v4.3 + New Features

QT android static linking issue

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 2 Posters 416 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kranthi
    wrote on last edited by
    #1

    I have compiled Qt source for android, I mentioned all the static libraries in .pro file, but while executing androiddeployqt, its searching for libqtforandroid.so, its getting failed here.
    below is the content of .pro file:

    QT += quick
    CONFIG -= import_plugins
    CONFIG += static-runtime
    DEFINES += STATIC
    static {
    QTPLUGIN.platforms = qminimal
    DEPENDPATH += /usr/local/Qt-5.12.3/lib
    DEPENDPATH += /usr/local/Qt-5.12.3/plugins/platforms/android
    LIBS += /usr/local/Qt-5.12.3/plugins/platforms/android/libqtforandroid.a
    CONFIG += c++11
    QTPLUGIN += qgif qicns qjpeg qtga qtiff qwbmp qwebp qtforandroid \
                qmldbg_debugger \
                qmldbg_inspector \
                qmldbg_local \
                qmldbg_messages \
                qmldbg_native \
                qmldbg_nativedebugger \
                qmldbg_preview \
                qmldbg_profiler \
                qmldbg_quickprofiler
    }
    
    
    message( $$CONFIG)
    # The following define makes your compiler emit warnings if you use
    # any Qt feature that has been marked deprecated (the exact warnings
    # depend on your compiler). Refer to the documentation for the
    # deprecated API to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    
    # You can also make your code fail to compile if it uses deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    SOURCES += \
            main.cpp
    
    RESOURCES += qml.qrc
    
    # Additional import path used to resolve QML modules in Qt Creator's code model
    QML_IMPORT_PATH =
    
    # Additional import path used to resolve QML modules just for Qt Quick Designer
    QML_DESIGNER_IMPORT_PATH =
    
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    
    

    Error we are getting:

    11:12:19: Running steps for project testapp2...
    11:12:19: Starting: "/home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/prebuilt/linux-x86_64/bin/make" clean -j4
    /usr/local/Qt-5.12.3/bin/qmake -o Makefile ../testapp2/testapp2.pro -spec android-clang CONFIG+=qtquickcompiler
    Project MESSAGE: lex yacc debug exceptions depend_includepath testcase_targets import_qpa_plugin file_copies qmake_use qt warn_on release link_prl android_install unversioned_soname unversioned_libname plugin_with_soname android_deployment_settings clang_pch_style android-16 optimize_size cross_compile release static android linux unix posix gcc clang llvm qtquickcompiler static-runtime c++11
    rm -f main_qml.cpp
    rm -f qmlcache_loader.cpp
    rm -f moc_predefs.h
    rm -f main.o main_qml.o qmlcache_loader.o
    rm -f *~ core *.core
    11:12:19: The process "/home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/prebuilt/linux-x86_64/bin/make" exited normally.
    11:12:19: Starting: "/usr/local/Qt-5.12.3/bin/qmake" /home/dev/testapp2/testapp2.pro -spec android-clang CONFIG+=qtquickcompiler
    Project MESSAGE: lex yacc debug exceptions depend_includepath testcase_targets import_qpa_plugin file_copies qmake_use qt warn_on release link_prl android_install unversioned_soname unversioned_libname plugin_with_soname android_deployment_settings clang_pch_style android-16 optimize_size cross_compile release static android linux unix posix gcc clang llvm qtquickcompiler static-runtime c++11
    11:12:20: The process "/usr/local/Qt-5.12.3/bin/qmake" exited normally.
    11:12:20: Starting: "/home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/prebuilt/linux-x86_64/bin/make" -f /home/dev/build-testapp2-Android_for_armeabi_v7a_Clang_Qt_Android_Qt_5_12_3-Release/Makefile qmake_all
    make: Nothing to be done for `qmake_all'.
    11:12:20: The process "/home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/prebuilt/linux-x86_64/bin/make" exited normally.
    11:12:20: Starting: "/home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/prebuilt/linux-x86_64/bin/make" -j4
    /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -c -D__ANDROID_API__=16 -target armv7-none-linux-androideabi -gcc-toolchain /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -fno-limit-debug-info -DANDROID_HAS_WSTRING --sysroot=/home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/sysroot -isystem /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/sysroot/usr/include/arm-linux-androideabi -isystem /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/sources/cxx-stl/llvm-libc++/include -isystem /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/sources/android/support/include -isystem /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/sources/cxx-stl/llvm-libc++abi/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -mthumb -Oz -std=gnu++11 -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DSTATIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../testapp2 -I. -I/usr/local/Qt-5.12.3/include -I/usr/local/Qt-5.12.3/include/QtQuick -I/usr/local/Qt-5.12.3/include/QtGui -I/usr/local/Qt-5.12.3/include/QtQml -I/usr/local/Qt-5.12.3/include/QtNetwork -I/usr/local/Qt-5.12.3/include/QtCore -I. -I/usr/local/Qt-5.12.3/mkspecs/android-clang -o main.o ../testapp2/main.cpp
    /usr/local/Qt-5.12.3/bin/qmlcachegen --resource=/home/dev/testapp2/qml.qrc -o main_qml.cpp ../testapp2/main.qml
    /usr/local/Qt-5.12.3/bin/qmlcachegen --resource-file-mapping=/home/dev/testapp2/qml.qrc -o qmlcache_loader.cpp ../testapp2/qml.qrc
    /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -c -D__ANDROID_API__=16 -target armv7-none-linux-androideabi -gcc-toolchain /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -fno-limit-debug-info -DANDROID_HAS_WSTRING --sysroot=/home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/sysroot -isystem /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/sysroot/usr/include/arm-linux-androideabi -isystem /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/sources/cxx-stl/llvm-libc++/include -isystem /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/sources/android/support/include -isystem /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/sources/cxx-stl/llvm-libc++abi/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -mthumb -Oz -std=gnu++11 -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DSTATIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../testapp2 -I. -I/usr/local/Qt-5.12.3/include -I/usr/local/Qt-5.12.3/include/QtQuick -I/usr/local/Qt-5.12.3/include/QtGui -I/usr/local/Qt-5.12.3/include/QtQml -I/usr/local/Qt-5.12.3/include/QtNetwork -I/usr/local/Qt-5.12.3/include/QtCore -I. -I/usr/local/Qt-5.12.3/mkspecs/android-clang -o main_qml.o main_qml.cpp
    /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -c -D__ANDROID_API__=16 -target armv7-none-linux-androideabi -gcc-toolchain /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -fno-limit-debug-info -DANDROID_HAS_WSTRING --sysroot=/home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/sysroot -isystem /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/sysroot/usr/include/arm-linux-androideabi -isystem /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/sources/cxx-stl/llvm-libc++/include -isystem /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/sources/android/support/include -isystem /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/sources/cxx-stl/llvm-libc++abi/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -mthumb -Oz -std=gnu++11 -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DSTATIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../testapp2 -I. -I/usr/local/Qt-5.12.3/include -I/usr/local/Qt-5.12.3/include/QtQuick -I/usr/local/Qt-5.12.3/include/QtGui -I/usr/local/Qt-5.12.3/include/QtQml -I/usr/local/Qt-5.12.3/include/QtNetwork -I/usr/local/Qt-5.12.3/include/QtCore -I. -I/usr/local/Qt-5.12.3/mkspecs/android-clang -o qmlcache_loader.o qmlcache_loader.cpp
    /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -D__ANDROID_API__=16 -target armv7-none-linux-androideabi -gcc-toolchain /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -Wl,--exclude-libs,libunwind.a --sysroot=/home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/platforms/android-16/arch-arm/ -Wl,-soname,libtestapp2.so -Wl,--gc-sections -Wl,--no-undefined -Wl,-z,noexecstack -shared -o libtestapp2.so main.o main_qml.o qmlcache_loader.o   /usr/local/Qt-5.12.3/plugins/platforms/android/libqtforandroid.a -ljnigraphics -landroid -L/usr/local/Qt-5.12.3/lib -lQt5EventDispatcherSupport -L/home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a -lQt5AccessibilitySupport -lQt5FontDatabaseSupport /usr/local/Qt-5.12.3/lib/libqtfreetype.a -lQt5EglSupport /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/platforms/android-16/arch-arm/usr/lib/libEGL.so -lQt5VulkanSupport -L/usr/local/Qt-5.12.3/plugins/imageformats -lqgif -lqicns -lqjpeg -lqtga -lqtiff -lqwbmp -lqwebp -L/usr/local/Qt-5.12.3/plugins/qmltooling -lqmldbg_debugger -lqmldbg_inspector -lqmldbg_local -lqmldbg_messages -lqmldbg_native -lqmldbg_nativedebugger -lqmldbg_preview -lqmldbg_profiler -lqmldbg_quickprofiler -lQt5PacketProtocol -lQt5Quick -lQt5Gui /usr/local/Qt-5.12.3/lib/libqtlibpng.a /usr/local/Qt-5.12.3/lib/libqtharfbuzz.a -lQt5Qml -lQt5Network -lQt5Core /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/platforms/android-16/arch-arm/usr/lib/libz.so /usr/local/Qt-5.12.3/lib/libqtpcre2.a -lc++ -llog -lz -lm -ldl -lc /home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/platforms/android-16/arch-arm/usr/lib/libGLESv2.so  -L/home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a -lc++ -llog -lz -lm -ldl -lc
    11:12:23: The process "/home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/prebuilt/linux-x86_64/bin/make" exited normally.
    11:12:23: Removing directory /home/dev/build-testapp2-Android_for_armeabi_v7a_Clang_Qt_Android_Qt_5_12_3-Release/android-build/assets
    11:12:23: Removing directory /home/dev/build-testapp2-Android_for_armeabi_v7a_Clang_Qt_Android_Qt_5_12_3-Release/android-build/libs
    11:12:23: Starting: "/home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/prebuilt/linux-x86_64/bin/make" INSTALL_ROOT=/home/dev/build-testapp2-Android_for_armeabi_v7a_Clang_Qt_Android_Qt_5_12_3-Release/android-build install
    /usr/local/Qt-5.12.3/bin/qmake -install qinstall -exe libtestapp2.so /home/dev/build-testapp2-Android_for_armeabi_v7a_Clang_Qt_Android_Qt_5_12_3-Release/android-build/libs/armeabi-v7a/libtestapp2.so
    11:12:23: The process "/home/dev/Documents/android-ndk-r20b-linux-x86_64/android-ndk-r20b/prebuilt/linux-x86_64/bin/make" exited normally.
    11:12:23: Starting: "/usr/local/Qt-5.12.3/bin/androiddeployqt" --input /home/dev/build-testapp2-Android_for_armeabi_v7a_Clang_Qt_Android_Qt_5_12_3-Release/android-libtestapp2.so-deployment-settings.json --output /home/dev/build-testapp2-Android_for_armeabi_v7a_Clang_Qt_Android_Qt_5_12_3-Release/android-build --android-platform android-29 --jdk /usr/lib/jvm/jdk-8u191-linux-x64/jdk1.8.0_191 --gradle
    Generating Android Package
      Input file: /home/dev/build-testapp2-Android_for_armeabi_v7a_Clang_Qt_Android_Qt_5_12_3-Release/android-libtestapp2.so-deployment-settings.json
      Output directory: /home/dev/build-testapp2-Android_for_armeabi_v7a_Clang_Qt_Android_Qt_5_12_3-Release/android-build/
      Application binary: /home/dev/build-testapp2-Android_for_armeabi_v7a_Clang_Qt_Android_Qt_5_12_3-Release/libtestapp2.so
      Android build platform: android-29
      Install to device: No
    
    Error reading file: /usr/local/Qt-5.12.3/plugins/platforms/android/libqtforandroid.so: No such file or directory
    .
    No platform plugin, neither libqtforandroid.so or libqtforandroidGL.so, included in package. Please include one.
    11:12:23: The process "/usr/local/Qt-5.12.3/bin/androiddeployqt" exited with code 12.
    Error while building/deploying project testapp2 (kit: Android for armeabi-v7a (Clang Qt Android (Qt-5.12.3)))
    When executing step "Build Android APK"
    11:12:23: Elapsed time: 00:04.
    
    1 Reply Last reply
    0
    • L Offline
      L Offline
      Leonardo
      wrote on last edited by
      #2

      As far as I know, static linking is not supported on Qt for Android.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved