Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Static build of Qt commercial desktop

Static build of Qt commercial desktop

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 483 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.
  • R Offline
    R Offline
    raulgd
    wrote on last edited by raulgd
    #1

    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!

    Raul Guerrero
    http://jimi.mx

    sierdzioS 1 Reply Last reply
    0
    • R raulgd

      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!

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

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

      1. Get the source code.
      2. Extract it.
      3. Run configure.
      4. Compile.
      5. Install.

      Windows (MSVC):

      1. Get dependencies:
      choco install python strawberryperl openssl cmake
      
      1. Make dirs 6.4.3-build and 6.4.3, then cd into 6.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 .
      

      (Z(:^

      R 1 Reply Last reply
      3
      • sierdzioS sierdzio

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

        1. Get the source code.
        2. Extract it.
        3. Run configure.
        4. Compile.
        5. Install.

        Windows (MSVC):

        1. Get dependencies:
        choco install python strawberryperl openssl cmake
        
        1. Make dirs 6.4.3-build and 6.4.3, then cd into 6.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 .
        
        R Offline
        R Offline
        raulgd
        wrote on last edited by raulgd
        #3

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

        Raul Guerrero
        http://jimi.mx

        S sierdzioS 2 Replies Last reply
        0
        • R raulgd

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

          S Offline
          S Offline
          SimonSchroeder
          wrote on last edited by
          #4

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

          R 1 Reply Last reply
          0
          • R raulgd

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

            sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

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

            (Z(:^

            S 1 Reply Last reply
            2
            • sierdzioS sierdzio

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

              S Offline
              S Offline
              SimonSchroeder
              wrote on last edited by
              #6

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

              sierdzioS 1 Reply Last reply
              3
              • S SimonSchroeder

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

                sierdzioS Offline
                sierdzioS Offline
                sierdzio
                Moderators
                wrote on last edited by
                #7

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

                (Z(:^

                1 Reply Last reply
                0
                • S SimonSchroeder

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

                  R Offline
                  R Offline
                  raulgd
                  wrote on last edited by
                  #8

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

                  Raul Guerrero
                  http://jimi.mx

                  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