Problems with building
-
Hi, I recently compiled Qt 6.5.2 Static from source on Windows. But when I try to use it, I get strange errors.
While trying to compile it, I ran into a few issues. Firstly, (strawberry) perl wasn't working, so I used MinGW (mingw1120_64) included in the Tools folder that the maintenance tool made and that worked. I got a warning that without perl some stuff doesn't have to work properly. Secondly, I got an error that
QtWebEnginewon't be built, but I don't remember what was the error (QtPdf also didn't build, because I don't have nodejs 12.0 installed, but I don't care about that). The build process also stopped once, because I ran out of storage space.Anyway, here are the errors that I'm currently facing:
error: C:\Qt\6.5.2-static\plugins\networkinformation\libqnetworklistmanager.a(qnetworklistmanagerevents.cpp.obj):qnetworklistmanagerevents.cpp:(.text$_ZN25QNetworkListManagerEvents24checkBehindCaptivePortalEv+0x6a): undefined reference to `__imp_VariantInit' error: C:\Qt\6.5.2-static\plugins\networkinformation\libqnetworklistmanager.a(qnetworklistmanagerevents.cpp.obj):qnetworklistmanagerevents.cpp:(.text$_ZN25QNetworkListManagerEvents24checkBehindCaptivePortalEv+0x13d): undefined reference to `__imp_VariantClear' error: C:\Qt\6.5.2-static\plugins\networkinformation\libqnetworklistmanager.a(qnetworklistmanagerevents.cpp.obj):qnetworklistmanagerevents.cpp:(.text$_ZN25QNetworkListManagerEvents24checkBehindCaptivePortalEv+0x1ea): undefined reference to `__imp_VariantClear' error: C:\Qt\6.5.2-static\plugins\networkinformation\libqnetworklistmanager.a(qnetworklistmanagerevents.cpp.obj):qnetworklistmanagerevents.cpp:(.text$_ZN25QNetworkListManagerEvents24checkBehindCaptivePortalEv+0x261): undefined reference to `__imp_VariantClear'Edit:
I forgot to mention, this is the modules included in my .pro file:core gui websockets networkAnd the included files in my header file (not everything):
#include <QtWebSockets/QWebSocket> #include <QJsonObject> #include <QJsonDocument> #include <QDebug> #include <QHostInfo> #include <QNetworkInterface> -
Hi, I recently compiled Qt 6.5.2 Static from source on Windows. But when I try to use it, I get strange errors.
While trying to compile it, I ran into a few issues. Firstly, (strawberry) perl wasn't working, so I used MinGW (mingw1120_64) included in the Tools folder that the maintenance tool made and that worked. I got a warning that without perl some stuff doesn't have to work properly. Secondly, I got an error that
QtWebEnginewon't be built, but I don't remember what was the error (QtPdf also didn't build, because I don't have nodejs 12.0 installed, but I don't care about that). The build process also stopped once, because I ran out of storage space.Anyway, here are the errors that I'm currently facing:
error: C:\Qt\6.5.2-static\plugins\networkinformation\libqnetworklistmanager.a(qnetworklistmanagerevents.cpp.obj):qnetworklistmanagerevents.cpp:(.text$_ZN25QNetworkListManagerEvents24checkBehindCaptivePortalEv+0x6a): undefined reference to `__imp_VariantInit' error: C:\Qt\6.5.2-static\plugins\networkinformation\libqnetworklistmanager.a(qnetworklistmanagerevents.cpp.obj):qnetworklistmanagerevents.cpp:(.text$_ZN25QNetworkListManagerEvents24checkBehindCaptivePortalEv+0x13d): undefined reference to `__imp_VariantClear' error: C:\Qt\6.5.2-static\plugins\networkinformation\libqnetworklistmanager.a(qnetworklistmanagerevents.cpp.obj):qnetworklistmanagerevents.cpp:(.text$_ZN25QNetworkListManagerEvents24checkBehindCaptivePortalEv+0x1ea): undefined reference to `__imp_VariantClear' error: C:\Qt\6.5.2-static\plugins\networkinformation\libqnetworklistmanager.a(qnetworklistmanagerevents.cpp.obj):qnetworklistmanagerevents.cpp:(.text$_ZN25QNetworkListManagerEvents24checkBehindCaptivePortalEv+0x261): undefined reference to `__imp_VariantClear'Edit:
I forgot to mention, this is the modules included in my .pro file:core gui websockets networkAnd the included files in my header file (not everything):
#include <QtWebSockets/QWebSocket> #include <QJsonObject> #include <QJsonDocument> #include <QDebug> #include <QHostInfo> #include <QNetworkInterface>@Sucharek I am trying to build a static file as well. I built static Qt 6.6 from source on Windows and I'm getting the exact same errors. The modules included in my program are quick and opengl. I don't understand why any network stuff is even being linked in my case. It would be cool if anyone could point out what we are possibly missing.
-
@Sucharek I am trying to build a static file as well. I built static Qt 6.6 from source on Windows and I'm getting the exact same errors. The modules included in my program are quick and opengl. I don't understand why any network stuff is even being linked in my case. It would be cool if anyone could point out what we are possibly missing.
The missing functions come from windows: https://learn.microsoft.com/en-us/windows/win32/api/oleauto/nf-oleauto-variantinit so you should link against oleauth lib as described in the msdn documentation.
-
The missing functions come from windows: https://learn.microsoft.com/en-us/windows/win32/api/oleauto/nf-oleauto-variantinit so you should link against oleauth lib as described in the msdn documentation.
@Christian-Ehrlicher Turns out one of the qt files already adds the linkage -loleaut32. Adding it to the pro file does nothing. Still get the same error message. Tested the function Variantinit in debug mode with dynamic linkage so OleAut32.lib seems to be working.
-
@Christian-Ehrlicher Turns out one of the qt files already adds the linkage -loleaut32. Adding it to the pro file does nothing. Still get the same error message. Tested the function Variantinit in debug mode with dynamic linkage so OleAut32.lib seems to be working.
When linking static the order of the libs is important. Imo it must be before libqnetworklistmanager.a
Or even simpler - use dynamic linking. -
When linking static the order of the libs is important. Imo it must be before libqnetworklistmanager.a
Or even simpler - use dynamic linking.@Christian-Ehrlicher Yeah, according to the compile output oleaut32 comes before qnetworklistmanager.
-
When linking static the order of the libs is important. Imo it must be before libqnetworklistmanager.a
Or even simpler - use dynamic linking.@Christian-Ehrlicher
how i change the order in static -
@Sucharek I am trying to build a static file as well. I built static Qt 6.6 from source on Windows and I'm getting the exact same errors. The modules included in my program are quick and opengl. I don't understand why any network stuff is even being linked in my case. It would be cool if anyone could point out what we are possibly missing.
@The-Smiling-Mickey I also had the same problem with static Qt 6.7. I found the -loleaut32 needs to be after the libqnetworklistmanager.a.
My 'quick-fix' solution is to add -loleaut32 to the list of lib dependencies (QMAKE_PRL_LIBS) in <qt6.x-static dir>/plugins/networkinformation/qnetworklistmanager.prl
The root of the problem seems to lie in Src/qtbase/src/plugins/networkinformation/networklistmanager/CMakeLists.txt, which adds the additional Windows dependencies for MSVC but not MINGW. Fiddling with that I managed recompile the Qt 6.7 Static build so that the right dependency ends up in qnetworklistmanager.prl. But I don't know my way around the CMakeLists, so I won't bother listing that change here; and the quick fix above is simpler anyway.