Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-99108

Probably broken static build

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Duplicate
    • Affects Version/s: 6.2.2
    • Fix Version/s: None
    • Component/s: Build System
    • Labels:
      None
    • Environment:
      Windows 10
    • Platform/s:
      Android

      Description

      I am not 100% sure that my build configuration is correct, but at least I was able to build QT 6.2.2 for Android with shared libs but when I add `-static` option and try the following configuration:

      configure.bat -platform win32-msvc -xplatform android-clang -prefix %MY_INSTALL_PATH% -qt-host-path %QT_HOST_PATH% ^  -c++std c++20 -static -no-openssl ^  -DQT_NO_EXCEPTIONS=1 -release -force-debug-info -opensource -confirm-license ^  -android-sdk %ANDROID_SDK_ROOT% -android-ndk %ANDROID_NDK_PATH% -android-ndk-platform android-23 -android-abis x86_64 ^  -skip qt3d -skip qt5compat -skip qtactiveqt -skip qtcharts -skip qtcoap -skip qtconnectivity ^  -skip qtdatavis3d -skip qtdoc -skip qtlottie -skip qtmqtt -skip qtnetworkauth -skip qtopcua ^  -skip qtserialport -skip qtpositioning -skip qtquicktimeline -skip qtquick3d -skip qtremoteobjects ^  -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtvirtualkeyboard -skip qtwayland -skip qtwebsockets ^  -skip qtwebchannel -skip qtwebengine -skip qtwebview ^  1> E:\temp\config-log15.txt 2>&1
      

      See the configuration log.

      I get linker errors while building `qttools` module:

      FAILED: qtbase/bin/liblinguist_x86_64.so
      cmd.exe /C "cd . && C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk\22.1.7171670\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=x86_64-none-linux-android23 --gcc-toolchain=C:/Users/D-Ef/AppData/Local/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=C:/Users/D-Ef/AppData/Local/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -g -DNDEBUG -Oz  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments    -Wl,--gc-sections -shared  -o qtbase\bin\liblinguist_x86_64.so @CMakeFiles\linguist.rsp  && cd ."
      ld: error: duplicate symbol: JNI_OnLoad
      >>> defined at qjnihelpers.cpp:382 (E:/repos/qt-everywhere-src-6.2.2/qtbase/src/corelib/kernel\qjnihelpers.cpp:382)
      >>>            qjnihelpers.cpp.o:(JNI_OnLoad) in archive qtbase/lib/libQt6Core_x86_64.a
      >>> defined at androidjnimain.cpp:897 (E:/repos/qt-everywhere-src-6.2.2/qtbase/src/plugins/platforms/android\androidjnimain.cpp:897)
      >>>            androidjnimain.cpp.o:(.text.JNI_OnLoad+0x0) in archive qtbase/plugins/platforms/libqtforandroid_x86_64.a
      clang++: error: linker command failed with exit code 1 (use -v to see invocation)
      [4306/4984] Automatic MOC and UIC for target Designer
      ninja: build stopped: subcommand failed.
      

      If I exclude qttools module, QT builds and installs successfully with static libs, but when I try to build my app I get linker errors related to wrong lib names:

      clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQuick/libqml_QtQuick_qtquick2plugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/libqml_QtQuick_Controls_qtquickcontrols2plugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Layouts/libqml_QtQuick_Layouts_qquicklayoutsplugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQml/libqml_QtQml_qmlplugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/impl/libqml_QtQuick_Controls_impl_qtquickcontrols2implplugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Basic/libqml_QtQuick_Controls_Basic_qtquickcontrols2basicstyleplugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Fusion/libqml_QtQuick_Controls_Fusion_qtquickcontrols2fusionstyleplugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Material/libqml_QtQuick_Controls_Material_qtquickcontrols2materialstyleplugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Imagine/libqml_QtQuick_Controls_Imagine_qtquickcontrols2imaginestyleplugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Universal/libqml_QtQuick_Controls_Universal_qtquickcontrols2universalstyleplugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQml/Models/libqml_QtQml_Models_modelsplugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQml/WorkerScript/libqml_QtQml_WorkerScript_workerscriptplugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Templates/libqml_QtQuick_Templates_qtquicktemplates2plugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Basic/impl/libqml_QtQuick_Controls_Basic_impl_qtquickcontrols2basicstyleimplplugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Shapes/libqml_QtQuick_Shapes_qmlshapesplugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Fusion/impl/libqml_QtQuick_Controls_Fusion_impl_qtquickcontrols2fusionstyleimplplugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Window/libqml_QtQuick_Window_quickwindowplugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Material/impl/libqml_QtQuick_Controls_Material_impl_qtquickcontrols2materialstyleimplplugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Imagine/impl/libqml_QtQuick_Controls_Imagine_impl_qtquickcontrols2imaginestyleimplplugin_x86_64.a'clang++: error: no such file or directory: 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Universal/impl/libqml_QtQuick_Controls_Universal_impl_qtquickcontrols2universalstyleimplplugin_x86_64.a'
      

      I renamed the libs:

      mv 'E:/Qt/Qt6.2.2/android/qml/QtQuick/libqtquick2plugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQuick/libqml_QtQuick_qtquick2plugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/libqtquickcontrols2plugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/libqml_QtQuick_Controls_qtquickcontrols2plugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Layouts/libqquicklayoutsplugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Layouts/libqml_QtQuick_Layouts_qquicklayoutsplugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQml/libqmlplugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQml/libqml_QtQml_qmlplugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/impl/libqtquickcontrols2implplugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/impl/libqml_QtQuick_Controls_impl_qtquickcontrols2implplugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Basic/libqtquickcontrols2basicstyleplugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Basic/libqml_QtQuick_Controls_Basic_qtquickcontrols2basicstyleplugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Fusion/libqtquickcontrols2fusionstyleplugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Fusion/libqml_QtQuick_Controls_Fusion_qtquickcontrols2fusionstyleplugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Material/libqtquickcontrols2materialstyleplugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Material/libqml_QtQuick_Controls_Material_qtquickcontrols2materialstyleplugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Imagine/libqtquickcontrols2imaginestyleplugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Imagine/libqml_QtQuick_Controls_Imagine_qtquickcontrols2imaginestyleplugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Universal/libqtquickcontrols2universalstyleplugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Universal/libqml_QtQuick_Controls_Universal_qtquickcontrols2universalstyleplugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQml/Models/libmodelsplugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQml/Models/libqml_QtQml_Models_modelsplugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQml/WorkerScript/libworkerscriptplugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQml/WorkerScript/libqml_QtQml_WorkerScript_workerscriptplugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Templates/libqtquicktemplates2plugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Templates/libqml_QtQuick_Templates_qtquicktemplates2plugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Basic/impl/libqtquickcontrols2basicstyleimplplugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Basic/impl/libqml_QtQuick_Controls_Basic_impl_qtquickcontrols2basicstyleimplplugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Shapes/libqmlshapesplugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Shapes/libqml_QtQuick_Shapes_qmlshapesplugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Fusion/impl/libqtquickcontrols2fusionstyleimplplugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Fusion/impl/libqml_QtQuick_Controls_Fusion_impl_qtquickcontrols2fusionstyleimplplugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Window/libquickwindowplugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Window/libqml_QtQuick_Window_quickwindowplugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Material/impl/libqtquickcontrols2materialstyleimplplugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Material/impl/libqml_QtQuick_Controls_Material_impl_qtquickcontrols2materialstyleimplplugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Imagine/impl/libqtquickcontrols2imaginestyleimplplugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Imagine/impl/libqml_QtQuick_Controls_Imagine_impl_qtquickcontrols2imaginestyleimplplugin_x86_64.a'mv 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Universal/impl/libqtquickcontrols2universalstyleimplplugin_x86_64.a' 'E:/Qt/Qt6.2.2/android/qml/QtQuick/Controls/Universal/impl/libqml_QtQuick_Controls_Universal_impl_qtquickcontrols2universalstyleimplplugin_x86_64.a'
      

      and when I did the next attempt to build my app I got the same linker error as with qttools module:

      ld: error: duplicate symbol: JNI_OnLoad
      >>> defined at androidjni.cpp androidjni.cpp
      >>>            androidjni.obj:(JNI_OnLoad)
      >>> defined at androidjnimain.cpp:897 (E:/repos/qt-everywhere-src-6.2.2/qtbase/src/plugins/platforms/android\androidjnimain.cpp:897)
      >>>            androidjnimain.cpp.o:(.text.JNI_OnLoad+0x0) in archive E:/Qt/Qt6.2.2/android/plugins/platforms/libqtforandroid_x86_64.ald: error: duplicate symbol: JNI_OnLoad
      >>> defined at androidjni.cpp androidjni.cpp
      >>>            androidjni.obj:(JNI_OnLoad)
      >>> defined at qjnihelpers.cpp:382 (E:/repos/qt-everywhere-src-6.2.2/qtbase/src/corelib/kernel\qjnihelpers.cpp:382)
      >>>            qjnihelpers.cpp.o:(.text.JNI_OnLoad+0x0) in archive E:/Qt/Qt6.2.2/android/lib/libQt6Core_x86_64.a
      clang++: error: linker command failed with exit code 1 (use -v to see invocation)
      

      at this point I stopped my experimentation, because I did not find a quick fix for that.

      Also it is not clear why DCMAKE_CXX_STANDARD=17 while `Using C++ standard ..................... C++20`

      My environment variables:

      set "CMAKE_ROOT=E:\PFiles\cmake-3.21.3-windows-x86_64\bin"
      set "NINJA_ROOT=E:\PFiles\ninja-win"
      set "JDK_ROOT=C:\Program Files\Java\jdk1.8.0_301\bin"
      set "MINGW_ROOT=E:\PFiles\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin"
      set "PERL_ROOT=E:\PFiles\Strawberry\perl\bin"
            
      set PATH=C:\WINDOWS\system32;C:\WINDOWS
      set PATH=%CMAKE_ROOT%;%PATH%
      set PATH=%NINJA_ROOT%;%PATH%
      set PATH=%JDK_ROOT%;%PATH%
      set PATH=%MINGW_ROOT%;%PATH%
      set PATH=%PERL_ROOT%;%PATH%
      set PATH=E:\PFiles\Python35;%PATH%
         
      set "ANDROID_SDK_ROOT=C:\Users\D-Ef\AppData\Local\Android\Sdk"
      set "ANDROID_NDK_PATH=C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk\22.1.7171670"
      set "ANDROID_BUILD_TOOLS_REVISION=31.0.0"
            
      set MY_INSTALL_PATH=E:\Qt\Qt6.2.2\android
      set QT_HOST_PATH=E:\Qt\Qt6.2.2\windows
      

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              qtbuildsystem Qt Build System Team
              Reporter:
              dmitriano Dmitry Efimov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes