Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to compile qt static source?
Qt 6.12 LTS is out! See what's new in the release blog

How to compile qt static source?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 1.5k 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.
  • K Offline
    K Offline
    Karine
    wrote on last edited by Karine
    #1

    I'm trying to follow the tutorial found here: https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW

    I already have qt 6.3.1 installed, i download the PowerShell script and changed it to:

    [CmdletBinding()]
    param(
        $QtSrcUrl = "https://download.qt.io/official_releases/qt/6.3/6.3.1/single/qt-everywhere-src-6.3.1.zip",
        $QtStaticDir = "C:\Qt\Static", # NO TRAILING SLASH
        $QtVersion = "6.3.1", #If you change this, you'll need to change the URL above to download as well...
        $MingwDir = "C:\Qt\Tools\mingw1120_64",
        [switch]$NoPause = $false
    )
    

    Im getting this error:

    Out-File : Could not find a part of the path 'C:\Qt\Static\6.3.1\mkspecs\win32-g++\qmake.conf'.
    At C:\Qt\qt-windows10-static-build.ps1:167 char:6
    + "@ | Out-File -Append $File -Encoding Ascii
    +      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : OpenError: (:) [Out-File], DirectoryNotFoundException
        + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand
    

    The folder C:\Qt\Static\6.3.1 is empty, why does the ps script is searching for something inside of it?

    JKSHJ 1 Reply Last reply
    0
    • K Karine

      I'm trying to follow the tutorial found here: https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW

      I already have qt 6.3.1 installed, i download the PowerShell script and changed it to:

      [CmdletBinding()]
      param(
          $QtSrcUrl = "https://download.qt.io/official_releases/qt/6.3/6.3.1/single/qt-everywhere-src-6.3.1.zip",
          $QtStaticDir = "C:\Qt\Static", # NO TRAILING SLASH
          $QtVersion = "6.3.1", #If you change this, you'll need to change the URL above to download as well...
          $MingwDir = "C:\Qt\Tools\mingw1120_64",
          [switch]$NoPause = $false
      )
      

      Im getting this error:

      Out-File : Could not find a part of the path 'C:\Qt\Static\6.3.1\mkspecs\win32-g++\qmake.conf'.
      At C:\Qt\qt-windows10-static-build.ps1:167 char:6
      + "@ | Out-File -Append $File -Encoding Ascii
      +      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : OpenError: (:) [Out-File], DirectoryNotFoundException
          + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand
      

      The folder C:\Qt\Static\6.3.1 is empty, why does the ps script is searching for something inside of it?

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by JKSH
      #2

      Hi, and welcome!

      @Karine said in How to compile qt static source?:

      The folder C:\Qt\Static\6.3.1 is empty, why does the ps script is searching for something inside of it?

      I've never used that script before (note that it is not official), but it looks like it was written for Qt 5.

      Qt 6 needs CMake to build. Do you have CMake and Ninja in your PATH?

      Anyway, try calling configure.bat directly (copy the command from the script) and check the output logs.

      See https://wiki.qt.io/Building_Qt_6_from_Git#On_Windows: for more details about building Qt 6.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      1
      • CesarC Offline
        CesarC Offline
        Cesar
        wrote on last edited by Cesar
        #3

        Thank you, I'm helping she, we have visual studio 2022, and I installed all the pre-requisites, python, pearl, etc, I know how to run the developer command prompt

        > mkdir qt6-build
        > cd qt6-build
        > ..\qt6\configure.bat -prefix C:\path\to\install
        > cmake --build .
        > cmake --install .
        

        I must change qt6-build to the path where I saved the source? i mean the qt-everywhere-src-6.3.1 folder?

        > mkdir qt6-build
        > cd C:\Qt\Static\src\qt-everywhere-src-6.3.1
        > C:\Qt\Static\src\qt-everywhere-src-6.3.1\configure.bat -prefix C:\path\to\install // <- ??
        > cmake --build .
        > cmake --install .
        

        What goes on C:\path\to\install?
        I'm confused about how to use these commands, i have no experience compiling projects like this.

        jsulmJ 1 Reply Last reply
        0
        • CesarC Cesar

          Thank you, I'm helping she, we have visual studio 2022, and I installed all the pre-requisites, python, pearl, etc, I know how to run the developer command prompt

          > mkdir qt6-build
          > cd qt6-build
          > ..\qt6\configure.bat -prefix C:\path\to\install
          > cmake --build .
          > cmake --install .
          

          I must change qt6-build to the path where I saved the source? i mean the qt-everywhere-src-6.3.1 folder?

          > mkdir qt6-build
          > cd C:\Qt\Static\src\qt-everywhere-src-6.3.1
          > C:\Qt\Static\src\qt-everywhere-src-6.3.1\configure.bat -prefix C:\path\to\install // <- ??
          > cmake --build .
          > cmake --install .
          

          What goes on C:\path\to\install?
          I'm confused about how to use these commands, i have no experience compiling projects like this.

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

          @Cesar said in How to compile qt static source?:

          I must change qt6-build to the path where I saved the source?

          No, this is the build folder. configure.bat script is inside the source folder. So:

          ..\qt-everywhere-src-6.3.1\configure.bat -prefix C:\path\to\install
          

          "What goes on C:\path\to\install?" - Qt binaries which will be generated during the build.

          If you're building using Microsoft compiler then don't forget: "Make sure to open the correct command prompt (e.g. 'x64 Native Tools Command Prompt for VS 2022')".

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • K Offline
            K Offline
            Karine
            wrote on last edited by Karine
            #5

            Qt binaries which will be generated during the build.

            @jsulm Could you point out the binaries needed to compile the static version containing everything the release version has?

            I was able to compile it using visual studio with the following commands:

            configure.bat -static -debug-and-release -platform win32-msvc -opensource -confirm-license -prefix "C:\Qt\Static"
            cmake --build . --parallel
            cmake --install .
            

            I compiled to test a new "empty project" as static/release and its size is 14MB, is possible somehow to 'optimize' it? i mean any flag, option, etc?

            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
            • Unsolved