Static Qt environment error using Qt5.15.0
-
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,
-
-
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
-
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 -
@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...
-
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/+/263548The 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!
-
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 -
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
-
@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.
-
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.14Visual Studio 2019
Windows 11Config command:
configure.bat -platform win32-msvc -opensource -release -verboseCompile 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 -
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
-
You should post the actual error.
-
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 -
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.
-