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

Error building Qt from source on Windows OS for Android OS



  • I tried to build Qt 5.15.0 as static library for Android on Windows 10. I used official instruction on qt site. I compiling on MinGW 8.1.0 x64. My script:

    set "JDK_ROOT=C:\Program Files\Java\jdk1.8.0_241\bin"
    set "PREFIX_OUT=D:\Qt\profiles\and_st_5_15_0"
    set "ANDROID_SDK_ROOT=C:\Users\range\AppData\Local\Android\Sdk"
    set "ANDROID_NDK_ROOT=C:\Users\range\AppData\Local\Android\Sdk\ndk\21.3.6528147"
    configure -static --disable-rpath -prefix %PREFIX_OUT% -xplatform android-clang -android-sdk %ANDROID_SDK_ROOT% -android-ndk %ANDROID_NDK_ROOT% -android-ndk-host windows-x86_64 -opensource -confirm-license -nomake examples -nomake tests -nomake tools -make libs -qt-zlib -qt-libpng -skip qttranslations -skip qtserialport -no-warnings-are-errors
    mingw32-make
    mingw32-make install
    

    While compiling i got errors:

    D:\Qt\5_15_0\src\qtbase\bin\moc.exe -DQT_NO_LINKED_LIST -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_STATICPLUGIN -DQT_PLUGIN -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_PLUGIN_RESOURCE_INIT_FUNCTION=qml_qtqml_models.2_modelsplugin_armeabi_v7a_plugin_resource_init --include D:/Qt/5_15_0/src/qtdeclarative/src/imports/models/.moc/armeabi-v7a/moc_predefs.h -ID:/Qt/5_15_0/src/qtbase/mkspecs/android-clang -ID:/Qt/5_15_0/src/qtdeclarative/src/imports/models -ID:/Qt/5_15_0/src/qtdeclarative/include/QtQmlModels/5.15.0 -ID:/Qt/5_15_0/src/qtdeclarative/include/QtQmlModels/5.15.0/QtQmlModels -ID:/Qt/5_15_0/src/qtdeclarative/include/QtQml/5.15.0 -ID:/Qt/5_15_0/src/qtdeclarative/include/QtQml/5.15.0/QtQml -ID:/Qt/5_15_0/src/qtbase/include/QtCore/5.15.0 -ID:/Qt/5_15_0/src/qtbase/include/QtCore/5.15.0/QtCore -ID:/Qt/5_15_0/src/qtdeclarative/include -ID:/Qt/5_15_0/src/qtdeclarative/include/QtQmlModels -ID:/Qt/5_15_0/src/qtdeclarative/include/QtQml -ID:/Qt/5_15_0/src/qtbase/include -ID:/Qt/5_15_0/src/qtbase/include/QtNetwork -ID:/Qt/5_15_0/src/qtbase/include/QtCore -IC:/Users/range/AppData/Local/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1 -IC:/Users/range/AppData/Local/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include -IC:/Users/range/AppData/Local/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/9.0.8/include -IC:/Users/range/AppData/Local/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android -IC:/Users/range/AppData/Local/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include -Muri=QtQml.Models.2 plugin.cpp -o .moc\armeabi-v7a\plugin.moc
    C:\Users\range\AppData\Local\Android\Sdk\ndk\21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++ -c -target armv7a-linux-androideabi21 -fno-limit-debug-info -fPIC -fstack-protector-strong -DANDROID -O2 -mthumb -Oz -fPIC -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wdate-time -Winconsistent-missing-override -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DQT_NO_LINKED_LIST -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_STATICPLUGIN -DQT_PLUGIN -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_PLUGIN_RESOURCE_INIT_FUNCTION=qml_qtqml_models.2_modelsplugin_armeabi_v7a_plugin_resource_init -I. -I..\..\..\include\QtQmlModels\5.15.0 -I..\..\..\include\QtQmlModels\5.15.0\QtQmlModels -I..\..\..\include\QtQml\5.15.0 -I..\..\..\include\QtQml\5.15.0\QtQml -ID:\Qt\5_15_0\src\qtbase\include\QtCore\5.15.0 -ID:\Qt\5_15_0\src\qtbase\include\QtCore\5.15.0\QtCore -I..\..\..\include -I..\..\..\include\QtQmlModels -I..\..\..\include\QtQml -ID:\Qt\5_15_0\src\qtbase\include -ID:\Qt\5_15_0\src\qtbase\include\QtNetwork -ID:\Qt\5_15_0\src\qtbase\include\QtCore -I.moc\armeabi-v7a -ID:\Qt\5_15_0\src\qtbase\mkspecs\android-clang -o .obj\armeabi-v7a\plugin.obj plugin.cpp
    In file included from plugin.cpp:97:
    .moc\armeabi-v7a\plugin.moc:119:1: error: variable has incomplete type 'void'
    QT_MOC_EXPORT_PLUGIN(QtQmlModelsPlugin, QtQmlModelsPlugin)
    ^
    D:\Qt\5_15_0\src\qtbase\include\QtCore/../../src/corelib/plugin/qplugin.h:176:5: note: expanded from macro
          'QT_MOC_EXPORT_PLUGIN'
        Q_PLUGIN_INSTANCE(PLUGINCLASS) \
        ^
    D:\Qt\5_15_0\src\qtbase\include\QtCore/../../src/corelib/plugin/qplugin.h:156:17: note: expanded from macro
          'Q_PLUGIN_INSTANCE'
                    QT_PLUGIN_RESOURCE_INIT \
                    ^
    D:\Qt\5_15_0\src\qtbase\include\QtCore/../../src/corelib/plugin/qplugin.h:146:23: note: expanded from macro
          'QT_PLUGIN_RESOURCE_INIT'
              extern void QT_PLUGIN_RESOURCE_INIT_FUNCTION(); \
                          ^
    <command line>:15:42: note: expanded from here
    #define QT_PLUGIN_RESOURCE_INIT_FUNCTION qml_qtqml_models.2_modelsplugin_armeabi_v7a_plugin_resource_init
                                             ^
    In file included from plugin.cpp:97:
    .moc\armeabi-v7a\plugin.moc:119:1: error: expected ';' at end of declaration
    D:\Qt\5_15_0\src\qtbase\include\QtCore/../../src/corelib/plugin/qplugin.h:176:5: note: expanded from macro
          'QT_MOC_EXPORT_PLUGIN'
        Q_PLUGIN_INSTANCE(PLUGINCLASS) \
        ^
    D:\Qt\5_15_0\src\qtbase\include\QtCore/../../src/corelib/plugin/qplugin.h:156:17: note: expanded from macro
          'Q_PLUGIN_INSTANCE'
                    QT_PLUGIN_RESOURCE_INIT \
                    ^
    D:\Qt\5_15_0\src\qtbase\include\QtCore/../../src/corelib/plugin/qplugin.h:146:23: note: expanded from macro
          'QT_PLUGIN_RESOURCE_INIT'
              extern void QT_PLUGIN_RESOURCE_INIT_FUNCTION(); \
                          ^
    <command line>:15:58: note: expanded from here
    #define QT_PLUGIN_RESOURCE_INIT_FUNCTION qml_qtqml_models.2_modelsplugin_armeabi_v7a_plugin_resource_init
                                                             ^
    2 errors generated.
    mingw32-make[5]: *** [Makefile.Armeabi-v7a:617: .obj\armeabi-v7a\plugin.obj] Error 1
    mingw32-make[5]: Leaving directory 'D:/Qt/5_15_0/src/qtdeclarative/src/imports/models'
    mingw32-make[4]: *** [Makefile:48: armeabi-v7a-all] Error 2
    mingw32-make[4]: Leaving directory 'D:/Qt/5_15_0/src/qtdeclarative/src/imports/models'
    mingw32-make[3]: *** [Makefile:114: sub-models-make_first] Error 2
    mingw32-make[3]: Leaving directory 'D:/Qt/5_15_0/src/qtdeclarative/src/imports'
    mingw32-make[2]: *** [Makefile:489: sub-imports-make_first-ordered] Error 2
    mingw32-make[2]: Leaving directory 'D:/Qt/5_15_0/src/qtdeclarative/src'
    mingw32-make[1]: *** [Makefile:50: sub-src-make_first] Error 2
    mingw32-make[1]: Leaving directory 'D:/Qt/5_15_0/src/qtdeclarative'
    mingw32-make: *** [Makefile:312: module-qtdeclarative-make_first] Error 2
    

    Someone know how to fix that?
    P.S.: Also i checked the problem on Qt 5_15_2. And got the same result.


Log in to reply