Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Static Qt environment error using Qt5.15.0
Forum Updated to NodeBB v4.3 + New Features

Static Qt environment error using Qt5.15.0

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
14 Posts 9 Posters 4.1k 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.
  • P porcupinebrux

    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

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #4

    @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
    -1
    • P Offline
      P Offline
      porcupinebrux
      wrote on last edited by porcupinebrux
      #5

      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
      2
      • A Offline
        A Offline
        aRI0U
        wrote on last edited by
        #6

        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
        0
        • R Offline
          R Offline
          Robin Hall
          wrote on last edited by Robin Hall
          #7

          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
          0
          • R 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 Offline
            C Offline
            Codetastic
            wrote on last edited by Codetastic
            #8

            @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
            2
            • J Offline
              J Offline
              james b-s
              wrote on last edited by james b-s
              #9

              I'm having this problem with qt 5.15.14. Perl, python, and ruby are all up-to-date. The link to the "old PowerShell script" is bad. Does someone have updated instructions, or powershell script. And, btw, which PowerShell script is this talking about.

              Perl v5.38.2
              Ruby 3.3.3
              Python 3.10.14

              Visual Studio 2019
              Windows 11

              Config command:
              configure.bat -platform win32-msvc -opensource -release -verbose

              Compile command:
              cl -c -FIglobal\qt_pch.h -Yuglobal\qt_pch.h -Fp.pch\release\Qt5Core_pch.pch -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -std:c++17 -EHsc -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_CORE_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 -DNDEBUG -DQT_NO_DEBUG -DPCRE2_CODE_UNIT_WIDTH=16 -DPCRE2_STATIC -D_WINDLL -I. -I..\3rdparty\zlib\src -Iglobal -I..\3rdparty\md5 -I..\3rdparty\md4 -I..\3rdparty\sha3 -I..\3rdparty -I..\3rdparty\double-conversion\include -I..\3rdparty\harfbuzz\src -I..\3rdparty\tinycbor\src -I.rcc\release -I....\include -I....\include\QtCore -I....\include\QtCore\5.15.14 -I....\include\QtCore\5.15.14\QtCore -Itmp -I.moc\release -I.tracegen\release -I..\3rdparty\pcre2\src -I....\mkspecs\win32-msvc -Fo.obj\release\ @C:\Users\JBF2\AppData\Local\Temp\nm4C0C.tmp

              1 Reply Last reply
              0
              • J Offline
                J Offline
                james b-s
                wrote on last edited by
                #10

                I'm operating under the assumption that the C++ standard has changed (or at least Microsoft's support of it) and what used to be legal C++, isn't anymore. But I am using a supported version of visual studio and the compiler option is set to use c++17. Also the comments saying that it is a problem with Perl, Python, and Ruby don't make sense to me, if the problem is the wrong compiler switches

                1 Reply Last reply
                0
                • Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #11

                  You should post the actual error.

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  J 1 Reply Last reply
                  0
                  • Christian EhrlicherC Christian Ehrlicher

                    You should post the actual error.

                    J Offline
                    J Offline
                    james b-s
                    wrote on last edited by
                    #12

                    Sorry, I thought I had

                    qmimeprovider.cpp
                    mimetypes\qmimeprovider.cpp(90): error C2479: 'QMimeProviderBase::{ctor}': 'allocate( )' is only valid for data items of static extent
                    mimetypes\qmimeprovider.cpp(90): error C2024: 'alignas' attribute applies to variables, data members and tag types only
                    mimetypes\qmimeprovider.cpp(639): error C2065: 'mimetype_database': undeclared identifier
                    mimetypes\qmimeprovider.cpp(640): error C2065: 'mimetype_database': undeclared identifier
                    mimetypes\qmimeprovider.cpp(640): error C2065: 'MimeTypeDatabaseOriginalSize': undeclared identifier
                    mimetypes\qmimeprovider.cpp(640): error C2338: Compressed MIME database is larger than the original size
                    mimetypes\qmimeprovider.cpp(642): error C2065: 'MimeTypeDatabaseOriginalSize': undeclared identifier
                    mimetypes\qmimeprovider.cpp(642): error C2338: Bundled MIME database is too big
                    mimetypes\qmimeprovider.cpp(644): error C2065: 'mimetype_database': undeclared identifier
                    mimetypes\qmimeprovider.cpp(645): error C2065: 'MimeTypeDatabaseOriginalSize': undeclared identifier

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      james b-s
                      wrote on last edited by
                      #13

                      I did an nmake clean which looped trying to delete the same files over an over. After about an hour, I killed it and redid the config and nmake. This time, it completed without the error, but it also didn't try to compile qmimeprovider.cpp. I'l post here later today and let people know if qt seems to have built properly.

                      1 Reply Last reply
                      0
                      • J Offline
                        J Offline
                        james b-s
                        wrote on last edited by
                        #14

                        I also may have posted this in the wrong thread. I thought I was posting it in one of the many threads reporting an identical error. This thread appears to have been reporting a similar qt build issue. Too many threads with too many qt build issues

                        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