Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to build a static Qt on Windows / MinGW using a PowerShell script
Forum Updated to NodeBB v4.3 + New Features

How to build a static Qt on Windows / MinGW using a PowerShell script

Scheduled Pinned Locked Moved Installation and Deployment
12 Posts 6 Posters 11.1k 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
    koahnig
    wrote on last edited by
    #2

    Thanks for sharing this. I skimmed through quickly, but it looks really impressive and you have invested quite a bit.
    I think it is worthwhile to make a "wiki entry":http://qt-project.org/wiki out of it. Or may be try to get it into the "blogs".
    Here it might be forgotten over time.

    Vote the answer(s) that helped you to solve your issue(s)

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #3

      Hi,

      I agree with koahnig, a more lasting support would be good. The guide however misses just one thing: the licensing issues that comes with static linking.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • T Offline
        T Offline
        thiel
        wrote on last edited by
        #4

        Thanks for your support.

        I will consider putting this in the wiki when I have some time. I think it would need more details and background info in a good wiki entry.

        @SGaist: This is only a script describing "how to build", nothing more. And yes, there are both licensing and technical implications / restrictions in the use of a static build, like the inability to use dynamic plugins in the applications. This is why using Qt in a static environment would deserve a very long and detailed article.

        Generally speaking, I prefer to avoid writing about licensing because there is no "truth" in this matter, only an aggregation of contradictory opinions (even though everyone is firmly convinced to hold the truth).

        In "this post":https://blog.qt.digia.com/blog/2009/11/30/qt-making-the-right-licensing-decision/, Cristy Hamley says "There is debate in the legal and open source communities as to whether static linking is permissible under the LGPL version 2.1. The uncertainty is caused by an inconsistency in the LGPL license itself [...]" A good summary for "nobody knows but everyone pretend to".

        My position is that the GPL family of licenses creates more problems than it solves. This is why I use the BSD license for the small project I mentioned. I just hope to never be sued for having used the LGPL static Qt libraries with my BSD code in an open-source project :-) But who knows, I have read so many silly ukases about GPL licensing...

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #5

          I understand your point but I was just thinking about a warning directing to Digia for further information. Nothing more fancy, we are not lawyers :-)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • N Offline
            N Offline
            Naelin
            wrote on last edited by
            #6

            You saved my day man. You are a hero!

            1 Reply Last reply
            0
            • T Offline
              T Offline
              thiel
              wrote on last edited by
              #7

              @koahnig Following your advice, I have adapted this post for a "wiki entry":http://qt-project.org/wiki/How-to-build-a-static-Qt-for-Windows-MinGW.

              The explanations are a bit more detailed. Information has been added on building static applications using Qt Creator.

              @SGaist The wiki entry mentions the licensing issue and links to Digia for more details.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                Very nice, thank you

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • JKSHJ Offline
                  JKSHJ Offline
                  JKSH
                  Moderators
                  wrote on last edited by
                  #9

                  Thank you very much for sharing this!

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

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    tgit23
                    wrote on last edited by
                    #10

                    Newbie here getting the following error. Any help would be greatly appreciated.

                    Building static Qt version 5.3.0
                    Using MinGW from C:\Qt\Qt5.3.0\Tools\mingw482_32

                    • cd qtbase
                    • C:\Qt\Static\src\qt-everywhere-opensource-src-5.3.0\qtbase\configure.bat -top-level -static -debug-and-release -platform win32-g++ -prefix C:\Qt\Static\5.3.0 -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sql-sqlite -no-openssl -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests

                    This is the Qt for Windows Open Source Edition.

                    You have already accepted the terms of the license.

                    Creating qmake...
                    mingw32-make: Nothing to be done for 'first'.
                    Running configuration tests...
                    In file included from arch.cpp:45:0:
                    C:\Program Files (x86)\Microsoft Visual Studio\VC98\include/stdio.h:77:24: error: redeclaration of C++ built-in type 'wchar_t' [-fpermissive]
                    typedef unsigned short wchar_t;
                    ^
                    mingw32-make: *** [arch.o] Error 1
                    Could not find output file: No such file or directory
                    mingw32-make: *** No targets specified and no makefile found. Stop.
                    mingw32-make: *** No rule to make target 'install'.

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      thiel
                      wrote on last edited by
                      #11

                      The path to stdio.h in the error message contains Microsoft Visual Studio\VC98, which seems to indicate that an old Visual C++ 6.0 interferes with the MinGW compiler.

                      The stdio.h file for MinGW is expected to be found in C:\Qt\Qt5.3.0\Tools\mingw482_32\i686-w64-mingw32\include.

                      Did you install first the dynamic version of Qt 5.3 with the MinGW toolset? See the full "wiki entry":http://qt-project.org/wiki/How-to-build-a-static-Qt-for-Windows-MinGW for this article for details.

                      Did you define environment variables which could lead MinGW to search the include files in the VC++ 6.0 tree?

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        tgit23
                        wrote on last edited by
                        #12

                        Thanks thiel; It did finally work after I un-installed VS6.0. I can't quite explain why even after removing \Microsoft Visual Studio and adding the MinGW path to stdio.h to my environment path it still tried to go to \Microsoft Visual Studio. But I didn't care much about VS6.0 so it worked out fine to just un-install it.

                        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