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. Building Static Qt 6.2.0 for Windows x64 Always Gives Errors When Configuring

Building Static Qt 6.2.0 for Windows x64 Always Gives Errors When Configuring

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
6 Posts 5 Posters 1.8k Views
  • 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.
  • K Offline
    K Offline
    Kurausukun
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    1
    • veryqtpersonV Offline
      veryqtpersonV Offline
      veryqtperson
      wrote on last edited by veryqtperson
      #2

      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 (in FindWrapZSTD.cmake?), or in the Homebrew zstd formula, or elsewhere. Either way, after I left only the static variant in zstdTargets.cmake, static Qt configured and built without problems (and then I reverted these changes that I made in zstdTargets.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 of zstd::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?).

      1 Reply Last reply
      1
      • F Offline
        F Offline
        fcying
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DungeonLords
          wrote on last edited by DungeonLords
          #4

          I have the same problem with Ubuntu 23.10. You can check my solution.

          veryqtpersonV 1 Reply Last reply
          0
          • D DungeonLords

            I have the same problem with Ubuntu 23.10. You can check my solution.

            veryqtpersonV Offline
            veryqtpersonV Offline
            veryqtperson
            wrote on last edited by
            #5

            It doesn't look like a solution, it seems you just disabled the feature, making it so zstd isn't required.

            T 1 Reply Last reply
            0
            • veryqtpersonV veryqtperson

              It doesn't look like a solution, it seems you just disabled the feature, making it so zstd isn't required.

              T Offline
              T Offline
              The Smiling Mickey
              wrote on last edited by
              #6

              @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.

              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