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. Building Qt Statically
QtWS25 Last Chance

Building Qt Statically

Scheduled Pinned Locked Moved General and Desktop
10 Posts 4 Posters 9.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.
  • R Offline
    R Offline
    ras123
    wrote on last edited by
    #1

    Hi,
    How to build my application statically? The following link says to run
    cd C:\path\to\Qt
    configure -static <any other options you need>

    After running the configure in the directory QtSDK\QtSource\4.8.1, I tried to rum mingw32-make sub-src but returns in an error as follows
    mingw32-make: *** No rule to make target `sub-src'. Stop

    1 Reply Last reply
    0
    • L Offline
      L Offline
      ludde
      wrote on last edited by
      #2

      Why did you try to build the sub-src target and not just the default target?
      If you include "the following link" it might be easier for someone to help you.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Swatwork
        wrote on last edited by
        #3

        I normally make a static Qt build like this:

        If the Qt sources are installed in (say) C:\Qt\qt-4.8.1 I create a parallel directory for the static build:

        C:\Qt\qt-4.8.1-static

        cd into C:\Qt\qt-4.8.1-static and type:

        ..\qt-4.8.1\configure -static <any other options>

        then make to compile.

        For Windows I usually use the library in situ so I would just add the new static build to Qt Creator and build my application with it.

        If the static build is just for deployment I don't bother to build the tools, demos, examples or qt3 support by adding:

        -nomake tools -nomake examples -nomake demos -no-qt3support

        I also skip webkit (saving a significant amount of time in the build) :

        -no-webkit

        In fact, I don't think static builds of WebKit are actually supported: http://qt-project.org/forums/viewthread/5970

        Hope this helps

        Edit:

        Note also this approach requires perl and the build tools (mingw) to be on the path. Be careful with Strawberry Perl - this has its own version of mingw which can conflict with your Qt toolchain. Try ActivePerl or make sure Strawberry Perls C tools are not in the path.

        1 Reply Last reply
        0
        • R Offline
          R Offline
          ras123
          wrote on last edited by
          #4

          Please see the link, sorry it was missed in the previous post
          http://doc-snapshot.qt-project.org/4.8/deployment-windows.html

          1 Reply Last reply
          0
          • L Offline
            L Offline
            ludde
            wrote on last edited by
            #5

            OK. I'm not sure what the sub-src target is supposed to do, but have you tried building without specifying an explicit target? I.e. just make (or mingw32-make)?

            And have you tried doing it the same way you do it on other platforms, using a shadow build?

            I'm not even sure you can build Qt from the distribution that comes with the Qt SDK. That is a precompiled binary release, and it might not be possible to use that to rebuild Qt. I would download the sources separately and build from them instead.

            1 Reply Last reply
            0
            • R Offline
              R Offline
              raaghuu
              wrote on last edited by
              #6

              [quote author="ras123" date="1341315476"]Hi,
              How to build my application statically? The following link says to run
              cd C:\path\to\Qt
              configure -static <any other options you need>

              After running the configure in the directory QtSDK\QtSource\4.8.1, I tried to rum mingw32-make sub-src but returns in an error as follows
              mingw32-make: *** No rule to make target `sub-src'. Stop
              [/quote]

              you need to run qmake after configure.... its placed in <path-to-qt>\bin after you've run configure...
              @c:\path\to\qt> bin\qmake project.pro //...project.pro is in <path-to-qt>@

              1 Reply Last reply
              0
              • R Offline
                R Offline
                ras123
                wrote on last edited by
                #7

                [quote author="Swatwork" date="1341318369"]
                Note also this approach requires perl and the build tools (mingw) to be on the path. Be careful with Strawberry Perl - this has its own version of mingw which can conflict with your Qt toolchain. Try ActivePerl or make sure Strawberry Perls C tools are not in the path.[/quote]

                Thank you Swatwork, it is just because of perl not installed, now building. Is it possible to use both Static and dynamic linking simultaneously? If yes how? I need static builds for deploying final applications?.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  Swatwork
                  wrote on last edited by
                  #8

                  I'm not sure what you mean by simultaneously. It's perfectly possible to have different build targets for shared and static libraries, for example a shared debug build and a static release build.

                  If you are using Qt Creator and have added the static build to the list of available Qt versions then you can configure the build targets from the project management page. Just specify the static Qt library for the release build.

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    ras123
                    wrote on last edited by
                    #9

                    Hi,
                    Yes. I need exactly as you said, "a shared debug build and a static release build".

                    When I used the qmake which builds statically, to build my application, got the following error
                    :-1: error: [ui_xxxx.h] Error 2

                    And the compiler output is

                    The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
                    Error while building project xxxx (target: Desktop)
                    When executing build step 'Make'

                    But it has no problem with the qmake in Qt Createor

                    Thanking You,
                    Ras

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      ras123
                      wrote on last edited by
                      #10

                      Hi,
                      It seems that the problem may with the PATH variable or with the mingw installed with the QtSDK. I added the following path

                      C:\QtSDK\QtSources\static\bin;C:\QtSDK\mingw\bin

                      And when running minggw32-make, it first tries to run the uic.exe from the path C:\QtSDK\QtSources\4.8.1\bin, but these are actually reside in the directory C:\QtSDK\QtSources\static\bin , why this problem? may be we make qt from a different director?

                      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