Building Static Qt 6.2.0 for Windows x64 Always Gives Errors When Configuring
-
I installed Qt 6.2.0 along with sources from the web installer and am trying to use that to build a static version, but I get the same error every time I attempt to configure and I cannot figure out why. My configure.bat arguments are:
configure -static -release -opensource -confirm-license -prefix C:\Qt\Static\6.2.0\mingw64
And I manually set my PATH to be:
C:\msys64\mingw64\bin;C:\Strawberry\perl\bin;C:\Strawberry\perl\site\bin;C:\Qt\Tools\CMake_64;C:\Qt\Tools\Ninja;C:\Ruby27-x64\bin
The errors I get from the command are:
CMake Error at C:/msys64/mingw64/lib/cmake/zstd/zstdTargets.cmake:37 (message): Some (but not all) targets in this export set were already defined. Targets Defined: zstd::libzstd_static Targets not yet defined: zstd::libzstd_shared Call Stack (most recent call first): C:/msys64/mingw64/lib/cmake/zstd/zstdConfig.cmake:1 (include) qtbase/cmake/FindZSTD.cmake:21 (find_package) C:/msys64/mingw64/share/cmake-3.21/Modules/CMakeFindDependencyMacro.cmake:47 (find_package) qtbase/lib/cmake/Qt6Core/Qt6CoreDependencies.cmake:45 (find_dependency) qtbase/lib/cmake/Qt6Core/Qt6CoreConfig.cmake:40 (include) qtbase/lib/cmake/Qt6/Qt6Config.cmake:176 (find_package) qtshadertools/CMakeLists.txt:21 (find_package) CMake Warning at qtbase/lib/cmake/Qt6/Qt6Config.cmake:176 (find_package): Found package configuration file: C:/Qt/6.2.0/Src/qtbase/lib/cmake/Qt6Core/Qt6CoreConfig.cmake but it set Qt6Core_FOUND to FALSE so package "Qt6Core" is considered to be NOT FOUND. Call Stack (most recent call first): qtshadertools/CMakeLists.txt:21 (find_package) -- Configuring incomplete, errors occurred! See also "C:/Qt/6.2.0/Src/CMakeFiles/CMakeOutput.log". See also "C:/Qt/6.2.0/Src/CMakeFiles/CMakeError.log". CMake Error at qtbase/cmake/QtProcessConfigureArgs.cmake:947 (message): CMake exited with code 1.
Additionally, here are CMakeError.log and CMakeOutput.log
Would anyone be willing to help me figure out what the hell is going on here?
-
Got the same problem when building a static Qt 6.5.1 on Steam Deck (Arch Linux), where zstd was provided by Homebrew (didn't want to risk messing up the "main" environment by installing system-wide dependencies via pacman).
As I understood, what's happening (at least, in my case) is that in
/home/linuxbrew/.linuxbrew/lib/cmake/zstd/zstdTargets.cmake
there is this line:foreach(_cmake_expected_target IN ITEMS zstd::libzstd_shared zstd::libzstd_static)
And the fix (for building static Qt 6.5.1 as of now) is to remove
zstd::libzstd_shared
part. That is most certainly not a great idea, especially that this file isn't meant to be modified, but I really can't tell where this actually needs to be "fixed": on Qt side (inFindWrapZSTD.cmake
?), or in the Homebrew zstd formula, or elsewhere. Either way, after I left only the static variant inzstdTargets.cmake
, static Qt configured and built without problems (and then I reverted these changes that I made inzstdTargets.cmake
).Related to that, there is this bugreport and this commit, which you could apply on top of 6.5.1 sources, but that won't resolve the problem still - it will only make you delete
zstd::libzstd_static
from zstd's config instead ofzstd::libzstd_shared
(which means that you'll end up with zstd being a shared/dynamic library dependency of your Qt build).Finally, peculiarly enough, building a static Qt on Mac OS, where zstd is also provided by Homebrew, didn't cause this problem for me (with Qt 6.5.1), although this topic claims that it might happen there too.
So, coming back to the original post in this thread, I would suggest you to take a look at zstd package that you have installed in your system - probably you'll be able to apply the same workaround in
zstdTargets.cmake
. Another option, I reckon, would be to disable zstd in Qt configuration, but I'm not sure if it is an optional dependency (still?). -
I encountered the same issue and later found it was related to msys2. I removed msys2 from the PATH and used the Qt-provided mingw64, and then compile successfully.
my path:
D:\tool\Qt\6.5.2\mingw_64\bin;D:\tool\Qt\Tools\mingw1120_64\bin;d:\tool\Qt\Tools\Ninja;d:\tool\Qt\Tools\CMake_64\bin
-
I have the same problem with Ubuntu 23.10. You can check my solution.
-
I have the same problem with Ubuntu 23.10. You can check my solution.
It doesn't look like a solution, it seems you just disabled the feature, making it so zstd isn't required.
-
It doesn't look like a solution, it seems you just disabled the feature, making it so zstd isn't required.
@veryqtperson I had no problems building Qt statically for Ubuntu but I did get this problem on Windows using msys2. The problem is the already mentioned zstdTargets.cmake. It seems to be conflicting with qt build files. So all you need to do is temporarily move or rename the folder the file is in.