Static build of Qt commercial desktop
-
Hi,
The Qt commercial installer only comes with dynamic link libraries for the desktop version.
I want to build a full static libraries version of it, but the documentation doesn't have the command, steps and dependencies I need to do such thing.
I Raised a support ticket and told me they cannot provide a static link version of the package, and although they took my suggestion as a new option for the commercial installer, still I don't see it.
Does anyone know how can I achieve such build? I read through the Qt build documentation but it doesn't really help much, I need to do the build for Windows x64 and Mac universal (x64 and arm64).
Thanks!
-
Hi,
The Qt commercial installer only comes with dynamic link libraries for the desktop version.
I want to build a full static libraries version of it, but the documentation doesn't have the command, steps and dependencies I need to do such thing.
I Raised a support ticket and told me they cannot provide a static link version of the package, and although they took my suggestion as a new option for the commercial installer, still I don't see it.
Does anyone know how can I achieve such build? I read through the Qt build documentation but it doesn't really help much, I need to do the build for Windows x64 and Mac universal (x64 and arm64).
Thanks!
@raulgd Steps are the same as for dynamic build, you just add
-static
flag. So any instructions you find are fine for this.In short:
- Get the source code.
- Extract it.
- Run
configure
. - Compile.
- Install.
Windows (MSVC):
- Get dependencies:
choco install python strawberryperl openssl cmake
- Make dirs
6.4.3-build
and6.4.3
, then cd into6.4.3-build
and run:
cmd.exe rem Modify these paths so that they are correct for you! set PATH=C:\qt\Tools\CMake_64\bin;C:\qt\Tools\Ninja;%PATH% "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsx86_amd64.bat" ..\qt-everywhere-src-6.4.3\configure.bat -static -static-runtime -plugin-manifests -no-openssl -schannel -c++std c++20 -dbus-runtime -confirm-license -release -nomake examples -nomake tests -prefix ..\6.4.3 -no-icu -no-glib -qt-doubleconversion -qt-pcre -qt-zlib -qt-freetype -qt-harfbuzz -qt-libpng -qt-libjpeg -qt-sqlite -qt-tiff -qt-webp -skip qtcoap -skip qtopcua -skip qtscxml -skip qtwebengine -skip qt3d -skip qtconnectivity -skip qtlanguageserver -skip qtpositioning -skip qtsensors -skip qt5compat -skip qtdatavis3d -skip qtlottie -skip qtquick3d -skip qtserialbus -skip qtwebview -skip qtactiveqt -skip qtquick3dphysics -skip qtserialport -skip qtquicktimeline -skip qtwayland -skip qtcharts -skip qthttpserver -skip qtremoteobjects -skip qtspeech -skip qtwebchannel -skip qtmultimedia cmake --build . --parallel cmake --install .
Of course you can modify this to not skip so many modules. You can skip D-Bus flags, too. I just copy-pasted commands from my last build.
macOS
You need to have xCode installed.
export QT_LICENSE_FILE=/path/to/qt-license.txt # PUT YOUR QT VERSION HERE! export QT_VER=6.4.3 rm -rf ${QT_VER}-build mkdir ${QT_VER}-build cd ${QT_VER}-build ../${QT_VER}/configure -static \ -prefix ../install \ -no-openssl \ -securetransport \ -confirm-license \ -release \ -nomake examples \ -nomake tests \ -qt-doubleconversion \ -qt-pcre \ -qt-zlib \ -qt-freetype \ -qt-harfbuzz \ -qt-libpng \ -qt-libjpeg \ -qt-sqlite \ -qt-tiff \ -qt-webp \ -skip qtcoap \ -skip qtopcua \ -skip qtscxml \ -skip qtwebengine \ -skip qt3d \ -skip qtconnectivity \ -skip qtlanguageserver \ -skip qtpositioning \ -skip qtlocation \ -skip qtsensors \ -skip qt5compat \ -skip qtdatavis3d \ -skip qtlottie \ -skip qtquick3d \ -skip qtserialbus \ -skip qtwebview \ -skip qtactiveqt \ -skip qtquick3dphysics \ -skip qtserialport \ -skip qtquicktimeline \ -skip qtwayland \ -skip qtcharts \ -skip qthttpserver \ -skip qtremoteobjects \ -skip qtspeech \ -skip qtwebchannel \ -skip qtmultimedia -- -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" cmake --build . --parallel cmake --install .
-
@raulgd Steps are the same as for dynamic build, you just add
-static
flag. So any instructions you find are fine for this.In short:
- Get the source code.
- Extract it.
- Run
configure
. - Compile.
- Install.
Windows (MSVC):
- Get dependencies:
choco install python strawberryperl openssl cmake
- Make dirs
6.4.3-build
and6.4.3
, then cd into6.4.3-build
and run:
cmd.exe rem Modify these paths so that they are correct for you! set PATH=C:\qt\Tools\CMake_64\bin;C:\qt\Tools\Ninja;%PATH% "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsx86_amd64.bat" ..\qt-everywhere-src-6.4.3\configure.bat -static -static-runtime -plugin-manifests -no-openssl -schannel -c++std c++20 -dbus-runtime -confirm-license -release -nomake examples -nomake tests -prefix ..\6.4.3 -no-icu -no-glib -qt-doubleconversion -qt-pcre -qt-zlib -qt-freetype -qt-harfbuzz -qt-libpng -qt-libjpeg -qt-sqlite -qt-tiff -qt-webp -skip qtcoap -skip qtopcua -skip qtscxml -skip qtwebengine -skip qt3d -skip qtconnectivity -skip qtlanguageserver -skip qtpositioning -skip qtsensors -skip qt5compat -skip qtdatavis3d -skip qtlottie -skip qtquick3d -skip qtserialbus -skip qtwebview -skip qtactiveqt -skip qtquick3dphysics -skip qtserialport -skip qtquicktimeline -skip qtwayland -skip qtcharts -skip qthttpserver -skip qtremoteobjects -skip qtspeech -skip qtwebchannel -skip qtmultimedia cmake --build . --parallel cmake --install .
Of course you can modify this to not skip so many modules. You can skip D-Bus flags, too. I just copy-pasted commands from my last build.
macOS
You need to have xCode installed.
export QT_LICENSE_FILE=/path/to/qt-license.txt # PUT YOUR QT VERSION HERE! export QT_VER=6.4.3 rm -rf ${QT_VER}-build mkdir ${QT_VER}-build cd ${QT_VER}-build ../${QT_VER}/configure -static \ -prefix ../install \ -no-openssl \ -securetransport \ -confirm-license \ -release \ -nomake examples \ -nomake tests \ -qt-doubleconversion \ -qt-pcre \ -qt-zlib \ -qt-freetype \ -qt-harfbuzz \ -qt-libpng \ -qt-libjpeg \ -qt-sqlite \ -qt-tiff \ -qt-webp \ -skip qtcoap \ -skip qtopcua \ -skip qtscxml \ -skip qtwebengine \ -skip qt3d \ -skip qtconnectivity \ -skip qtlanguageserver \ -skip qtpositioning \ -skip qtlocation \ -skip qtsensors \ -skip qt5compat \ -skip qtdatavis3d \ -skip qtlottie \ -skip qtquick3d \ -skip qtserialbus \ -skip qtwebview \ -skip qtactiveqt \ -skip qtquick3dphysics \ -skip qtserialport \ -skip qtquicktimeline \ -skip qtwayland \ -skip qtcharts \ -skip qthttpserver \ -skip qtremoteobjects \ -skip qtspeech \ -skip qtwebchannel \ -skip qtmultimedia -- -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" cmake --build . --parallel cmake --install .
@sierdzio thanks for the reply!
I see that you add things like no-openssl and a lot of skips, but in the commercial installer you can select it to install OpenSSL 3.x right? I want a build that I can build all modules that come in the commercial version (pdf, multimedia, network, ssl, xml, charts and such) I guess it must have some external dependencies or something that I need to install by myself?
-
@sierdzio thanks for the reply!
I see that you add things like no-openssl and a lot of skips, but in the commercial installer you can select it to install OpenSSL 3.x right? I want a build that I can build all modules that come in the commercial version (pdf, multimedia, network, ssl, xml, charts and such) I guess it must have some external dependencies or something that I need to install by myself?
@raulgd said in Static build of Qt commercial desktop:
I see that you add things like no-openssl and a lot of skips, but in the commercial installer you can select it to install OpenSSL 3.x right?
Do you want OpenSSL to be statically or dynamically linked? Just like the Qt libs OpenSSL installed through the installer is most likely a dynamic library. If you want this to be static as well, you need to compile it beforehand and point Qt to it.
-
@sierdzio thanks for the reply!
I see that you add things like no-openssl and a lot of skips, but in the commercial installer you can select it to install OpenSSL 3.x right? I want a build that I can build all modules that come in the commercial version (pdf, multimedia, network, ssl, xml, charts and such) I guess it must have some external dependencies or something that I need to install by myself?
@raulgd said in Static build of Qt commercial desktop:
@sierdzio thanks for the reply!
I see that you add things like no-openssl and a lot of skips, but in the commercial installer you can select it to install OpenSSL 3.x right?
It only installs OpenSSL source code, not compiled libraries. But you do not need OpenSSL on Windows or macOS, Qt can use system-provided security libs instead. That is why I'm using
-schannel
and-securetransport
there.I want a build that I can build all modules that come in the commercial version (pdf, multimedia, network, ssl, xml, charts and such) I guess it must have some external dependencies or something that I need to install by myself?
Possibly yes, I don't know. Since compiling Qt takes a lot of time I usually try to skip all the modules I don't need.
-
@raulgd said in Static build of Qt commercial desktop:
@sierdzio thanks for the reply!
I see that you add things like no-openssl and a lot of skips, but in the commercial installer you can select it to install OpenSSL 3.x right?
It only installs OpenSSL source code, not compiled libraries. But you do not need OpenSSL on Windows or macOS, Qt can use system-provided security libs instead. That is why I'm using
-schannel
and-securetransport
there.I want a build that I can build all modules that come in the commercial version (pdf, multimedia, network, ssl, xml, charts and such) I guess it must have some external dependencies or something that I need to install by myself?
Possibly yes, I don't know. Since compiling Qt takes a lot of time I usually try to skip all the modules I don't need.
@sierdzio said in Static build of Qt commercial desktop:
Since compiling Qt takes a lot of time I usually try to skip all the modules I don't need.
Qt compiles a lot faster on Windows if you minimize the console window. There is just too much output during compilation that it slows it down if it needs to be shown on screen. The difference is really significant.
-
@sierdzio said in Static build of Qt commercial desktop:
Since compiling Qt takes a lot of time I usually try to skip all the modules I don't need.
Qt compiles a lot faster on Windows if you minimize the console window. There is just too much output during compilation that it slows it down if it needs to be shown on screen. The difference is really significant.
@SimonSchroeder said in Static build of Qt commercial desktop:
@sierdzio said in Static build of Qt commercial desktop:
Since compiling Qt takes a lot of time I usually try to skip all the modules I don't need.
Qt compiles a lot faster on Windows if you minimize the console window. There is just too much output during compilation that it slows it down if it needs to be shown on screen. The difference is really significant.
Good info, thanks! I will try it out.
-
@raulgd said in Static build of Qt commercial desktop:
I see that you add things like no-openssl and a lot of skips, but in the commercial installer you can select it to install OpenSSL 3.x right?
Do you want OpenSSL to be statically or dynamically linked? Just like the Qt libs OpenSSL installed through the installer is most likely a dynamic library. If you want this to be static as well, you need to compile it beforehand and point Qt to it.
@SimonSchroeder thanks for the reply, yeah I want OpenSSL static linked as well.. .I want to make the binary as self contained as possible, so I wanna reduce the use of shared libraries as much as I can.
I wanted help from commercial support, but as I have the startup plan (I don't own a huge company) I don't have any paid dedicated support so my requests mostly go to "yeah maybe one day we'll look into it" bin.