Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Unsolved Static Qt environment error using Qt5.15.0

    Installation and Deployment
    7
    8
    2164
    Loading More Posts
    • 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.
    • D
      Dries last edited by

      Hi,

      I'm upgrading to Qt 5.15.0 and fail to create a new static Qt environment
      I followed this helpful page: https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW

      • The powershell script calls configure.bat using the option -qt-sql-sqlite, which gives this error:

        ERROR: Invalid value given for boolean command line option 'sql-sqlite'.
        
      • When configuring withotu that option, and then executing

        mingw32-make -k -j4
        

        I get this output:

        compiling mimetypes/qmimeprovider.cpp
        In file included from global\qt_pch.h:56:
        mimetypes\qmimeprovider.cpp: In constructor 'QMimeXMLProvider::QMimeXMLProvider(QMimeDatabasePrivate*, 
        QMimeXMLProvider::InternalDatabaseEnum)':
        mimetypes\qmimeprovider.cpp:632:30: error: 'mimetype_database' was not declared in this scope
             Q_STATIC_ASSERT_X(sizeof(mimetype_database), "Bundled MIME database is empty");
                                      ^~~~~~~~~~~~~~~~~
        global/qglobal.h:121:68: note: in definition of macro 'Q_STATIC_ASSERT_X'
         #  define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
                                                                            ^~~~~~~~~
        mimetypes\qmimeprovider.cpp:632:30: note: suggested alternative: 'mimeTypeForName'
             Q_STATIC_ASSERT_X(sizeof(mimetype_database), "Bundled MIME database is empty");
                                      ^~~~~~~~~~~~~~~~~
        global/qglobal.h:121:68: note: in definition of macro 'Q_STATIC_ASSERT_X'
         #  define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
                                                                            ^~~~~~~~~
        mimetypes\qmimeprovider.cpp:633:52: error: 'MimeTypeDatabaseOriginalSize' was not declared in this scope
             Q_STATIC_ASSERT_X(sizeof(mimetype_database) <= MimeTypeDatabaseOriginalSize,
                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
        global/qglobal.h:121:68: note: in definition of macro 'Q_STATIC_ASSERT_X'
         #  define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
                                                                            ^~~~~~~~~
        mimetypes\qmimeprovider.cpp:633:52: note: suggested alternative: 'QMimeDatabasePrivate'
             Q_STATIC_ASSERT_X(sizeof(mimetype_database) <= MimeTypeDatabaseOriginalSize,
                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
        global/qglobal.h:121:68: note: in definition of macro 'Q_STATIC_ASSERT_X'
         #  define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
                                                                            ^~~~~~~~~
        

      Any ideas why this is caused and how this can get fixed?

      Br,

      1 Reply Last reply Reply Quote 1
      • L
        Lukas_L last edited by

        Hi Dries,

        I can confirm this error also on Qt5.15.1with the following configuration flags:

        configure.bat -static -debug-and-release -platform win32-g++ -prefix $QtDir
                -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -no-openssl
                -no-sql-mysql -plugin-sql-sqlite -plugin-sql-odbc -opensource -confirm-license
                -make libs -nomake tools -nomake examples -nomake tests
                -I %MYSQL_INCLUDE_x86% -L %MYSQL_LIB_x86%
        

        For QT5.12.9 this configuration compiled flawless.

        I'm happy for any hint that leads to a quick fix of this topic.

        Cheers

        Lukas

        1 Reply Last reply Reply Quote 1
        • P
          porcupinebrux last edited by

          I can also confirm that it is impossible to build Qt 5.15.1 statically with the following configuration:

          configure.bat -static -release -platform win32-g++ -prefix $QtDir `
                  -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -sql-sqlite -opengl desktop -skip qtwebengine`
                  -opensource -confirm-license `
                  -make libs -nomake tools -nomake examples -nomake tests
          

          The same error occurs when building qtbase/src/corelib/mimetypes/qmimeprovider.cpp:

          mimetypes\qmimeprovider.cpp:632:30: error: 'mimetype_database' was not declared in this scope
               Q_STATIC_ASSERT_X(sizeof(mimetype_database), "Bundled MIME database is empty");
          

          Has a bug been opened in Qt's bug tracking system?
          George

          jsulm 1 Reply Last reply Reply Quote 0
          • jsulm
            jsulm Lifetime Qt Champion @porcupinebrux last edited by

            @porcupinebrux said in Static Qt environment error using Qt5.15.0:

            Has a bug been opened in Qt's bug tracking system?

            You can check...

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote -1
            • P
              porcupinebrux last edited by porcupinebrux

              Well, of course I checked :)

              The following bug report is very close to the problem that Dries is facing:
              https://bugreports.qt.io/browse/QTBUG-81484 - Building from sources fails on macOS with MimeTypeDatabaseOriginalSize error
              The change in behaviour from Qt 5.14 to 5.15 seems to have been caused by the following change:
              https://codereview.qt-project.org/c/qt/qtbase/+/263548

              The issue has also been reported here: https://www.qtcentre.org/threads/71253-Static-Build-Issue-on-QT-5-15-0 but no reply has been posted to that forum.

              The proposed resolution qt QTBUG-81484 seems to imply that a problem with the system's Perl installation is causing the qtbase/src/corelib/mimetypes/mime/generate.pl script to fail (and thus the Mime Type Database is not generated correctly).
              This could potentially explain why building a static version of 5.15.1 from source succeeds under Linux but fails under Windows. I have Strawberry Perl (correctly) installed on my system, but I will try with Activestate Perl (that the Qt project document on static building recommends) and I will report any progress.

              In the meantime, if any other member of the forum has more information (in addition to words of encouragement to search the bug tracker) it would be most helpful!

              1 Reply Last reply Reply Quote 2
              • A
                aRI0U last edited by

                I tried installing ActiveState Perl but it did not work... The only solution I found was to downgrade to version 5.12.10.

                To build statically Qt 5.12.10 with MinGW I ran the following powershell script : https://github.com/aRI0U/windows-build-qt-static
                This script is adapted from another script I found on wiki.qt.io. I don't know what mean all the options next to configure.bat but this set of options work for me

                1 Reply Last reply Reply Quote 0
                • R
                  Robin Hall last edited by Robin Hall

                  after analyzing the output from my copy of the powershell script, I discovered that these two commands are not running properly:

                  cmd /c D:\Qt\5.12.2-static-mingw\src\qt-everywhere-src-5.15.2\qtbase\src\corelib\mimetypes\mime\generate.bat mimetypes\mime\packages\freedesktop.org.xml > .rcc\debug\qmimeprovider_database.cpp
                  cmd /c D:\Qt\5.12.2-static-mingw\src\qt-everywhere-src-5.15.2\qtbase\src\corelib\mimetypes\mime\generate.bat mimetypes\mime\packages\freedesktop.org.xml > .rcc\release\qmimeprovider_database.cpp
                  'powershell' is not recognized as an internal or external command,
                  operable program or batch file.
                  'powershell' is not recognized as an internal or external command,
                  operable program or batch file.
                  mingw32-make[4]: *** [Makefile.Debug:1311: .rcc/debug/qmimeprovider_database.cpp] Error 9009
                  mingw32-make[4]: *** [Makefile.Release:1311: .rcc/release/qmimeprovider_database.cpp] Error 9009
                  

                  this batch file generates the 'qmimeprovider_database.cpp', which provides the necessary source file required for 'mimetypes\qmimeprovider.cpp' to build.

                  from what i can tell, the path for the makefile doesn't seem to be set up properly, because it won't find perl or even the 'powershell' command for fallback. both 'perl' and 'powershell' are in my system path, and running both 'powershell' and 'perl' will work from powershell or a standard command prompt.

                  As a workaround, if you run the failing commands

                  cmd /c <your static library build directory>\src\qt-everywhere-src-5.15.2\qtbase\src\corelib\mimetypes\mime\generate.bat mimetypes\mime\packages\freedesktop.org.xml > .rcc\debug\qmimeprovider_database.cpp
                  cmd /c <your static library build directory>\src\qt-everywhere-src-5.15.2\qtbase\src\corelib\mimetypes\mime\generate.bat mimetypes\mime\packages\freedesktop.org.xml > .rcc\release\qmimeprovider_database.cpp
                  

                  from the directory: <your static library build directory>/src/qt-everywhere-src-5.15.2/qtbase/src/corelib

                  the files will generate and 5.14.4 will build.

                  I am getting additional errors, but this hasn't stopped my program from building at this time.

                  g++ -c -fno-keep-inline-dllexport -O2 -std=c++1z -fno-exceptions -Wall -Wextra -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -ffunction-sections -fdata-sections -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_STATIC_BUILD -DWINVER=0x0601 -D_WIN32_WINNT=0x060
                  1 -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_CAST_FROM_ASCII -DQT_NO_FOREACH -DLIBEGL_NAME=libEGL -DLIBGLESV2_NAME=libGLESv2 -DQT_DEPRECATED_WARNINGS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_STATICPLUGIN -DQT_PLUGIN -DQT_EVENTDISPATCHER_SUPPORT_LIB -DQT_FON
                  TDATABASE_SUPPORT_LIB -DQT_THEME_SUPPORT_LIB -DQT_ACCESSIBILITY_SUPPORT_LIB -DQT_WINDOWSUIAUTOMATION_SUPPORT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_PLUGIN_RESOURCE_INIT_FUNCTION=qdirect2d_plugin_resource_init -I. -I..\windows -I..\..\..\3rdparty\wintab -I..\..\..\..\include -I..\..\..\..\include\QtEventDispatch
                  erSupport -I..\..\..\..\include\QtEventDispatcherSupport\5.15.2 -I..\..\..\..\include\QtEventDispatcherSupport\5.15.2\QtEventDispatcherSupport -I..\..\..\..\include\QtFontDatabaseSupport -I..\..\..\..\include\QtFontDatabaseSupport\5.15.2 -I..\..\..\..\include\QtFontDatabaseSupport\5.15.2\QtFontDatabaseSuppor
                  t -I..\..\..\..\include\QtThemeSupport -I..\..\..\..\include\QtThemeSupport\5.15.2 -I..\..\..\..\include\QtThemeSupport\5.15.2\QtThemeSupport -I..\..\..\..\include\QtAccessibilitySupport -I..\..\..\..\include\QtAccessibilitySupport\5.15.2 -I..\..\..\..\include\QtAccessibilitySupport\5.15.2\QtAccessibilitySup
                  port -I..\..\..\..\include\QtWindowsUIAutomationSupport -I..\..\..\..\include\QtWindowsUIAutomationSupport\5.15.2 -I..\..\..\..\include\QtWindowsUIAutomationSupport\5.15.2\QtWindowsUIAutomationSupport -I..\..\..\..\include\QtGui\5.15.2 -I..\..\..\..\include\QtGui\5.15.2\QtGui -I..\..\..\..\include\QtGui -I..
                  \..\..\..\include\QtCore\5.15.2 -I..\..\..\..\include\QtCore\5.15.2\QtCore -I..\..\..\..\include\QtCore -I.moc\release -I..\..\..\..\mkspecs\win32-g++  -o .obj\release\qwindowsuiagridprovider.o ..\windows\uiautomation\qwindowsuiagridprovider.cpp
                  In file included from ..\windows\uiautomation\qwindowsuiabaseprovider.h:50,
                                   from ..\windows\uiautomation\qwindowsuiagridprovider.h:46,
                                   from ..\windows\uiautomation\qwindowsuiagridprovider.cpp:43:
                  ..\..\..\..\include\QtWindowsUIAutomationSupport\5.15.2/QtWindowsUIAutomationSupport/private/qwindowsuiawrapper_p.h:1:10: fatal error: ../../../../../src/platformsupport/windowsuiautomation/qwindowsuiawrapper_p.h: No such file or directory
                   #include "../../../../../src/platformsupport/windowsuiautomation/qwindowsuiawrapper_p.h"
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                  compilation terminated.
                  mingw32-make[6]: *** [Makefile.Release:14245: .obj/release/qwindowsuiagridprovider.o] Error 1
                  
                  C 1 Reply Last reply Reply Quote 0
                  • C
                    Codetastic @Robin Hall last edited by Codetastic

                    @Robin-Hall - I faced this issue recently using Qt 5.15.2 and it turns out that it's really a combination of the PowerShell script being out of date and not installing the required pre-requisites as the README that comes with the qt-everywhere source package instructs.

                    Per the README, ensure that the following tools can be found in the path:

                    • Perl version 5.12 or later [http://www.activestate.com/activeperl/]
                    • Python version 2.7 or later [http://www.activestate.com/activepython/]
                    • Ruby version 1.9.3 or later [http://rubyinstaller.org/]

                    I have also updated the old PowerShell script, and now the static build works with Qt 5.15.2 (haven't tested it with version 6): https://gist.github.com/mrfaptastic/80e909c9a8237994471bce2d17657779

                    Hopefully the Wiki moderators approve my changes to the instructions there as well.

                    1 Reply Last reply Reply Quote 2
                    • First post
                      Last post