How to build a static Qt on Windows / MinGW using a PowerShell script
-
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.
-
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...
-
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 :-)
-
You saved my day man. You are a hero!
-
@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.
-
Very nice, thank you
-
Thank you very much for sharing this!
-
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'. -
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?
-
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.