How to compile qt static source?
-
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.OutFileCommandThe folder
C:\Qt\Static\6.3.1is empty, why does the ps script is searching for something inside of it? -
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.OutFileCommandThe folder
C:\Qt\Static\6.3.1is empty, why does the ps script is searching for something inside of it?Hi, and welcome!
@Karine said in How to compile qt static source?:
The folder
C:\Qt\Static\6.3.1is 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.batdirectly (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.
-
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.1folder?> 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. -
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.1folder?> 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.@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')".
-
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?