Prequisits are QT5 source, QT5 MinGW installed to c:\Qt. It’s important to know that I banged my head with current mingw separate compiler that does use Dfarf 2 and 3 but Qt5 uses version 4 so you must use QT5 mingw to build satic lib.
NOTE: The Source and static build takes atleast 40gb space while compiling and more until it cleans everything. Remember to use harddrive that has lot of space available for the source. The source does not need to be in C:. You can put it any drive and make it install the final build to c: to avoid any huge space taking at C:.
The steps are:
1. Download Source http://qt-project.org/downloads as zipped or 7-zipped. Copy source folder to C:\.
2. Append these lines to “c:\qt-everywhere…\qtbase\mkspecs\win32-g++\qmake.conf”:
# [QT-STATIC-PATCH]
QMAKE_LFLAGS += -static -static-libgcc
QMAKE_CFLAGS_RELEASE -= -O2
QMAKE_CFLAGS_RELEASE += -Os -momit-leaf-frame-pointer
DEFINES += QT_STATIC_BUILD
Open cmd, navigate to c:\qt5-everywhere and type these commands:
3. Type enverimetal variable:
set path=C:\Qt\Qt5.2.1\Tools\mingw48_32\bin;C:\Qt\Qt5.2.1\Tools\mingw48_32\opt\bin;$env:SystemRoot\system32;$env:SystemRoot
4. Force English locale to avoid weird effects of tools localization.
set LANG="en"
5.Set environment variable QT_INSTALL_PREFIX. Documentation says it should be used by configure as prefix but this does not seem to work. So, we will also specify -prefix option in configure.
set QT_INSTALL_PREFIX=C:\Qt\Qt5.2.1static
When updating versions then just change the numbering on the install prefixes. You can add your own Install path everywhere on your system.
6. Then we start configure with command:
configure.bat -static -debug-and-release -platform win32-g++ -prefix c:\Qt\Qt5.2.1static -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
These lines are copied from orginal QT5 powershell script and since the script did not work for me so I decided to use copy paste method. If you want more libs to be combiled please refer QT configure options at: http://qt-project.org/doc/qt-5/configure-options.html.
The -prefix c:\Qt\Qt5.2.1static needs to be updated when defining another install path: This is added here because the install path enviromental variable does not always work.
7. Compiling time:
mingw32-make -k -j4
8. Finally installing build to defined path earlier in configure:
mingw32-make -k install
Ok I have build sucesfully and provide this build as 7-zip file here later stay tuned.
Adding MSYS to QT environment:
Prequisits: Install MSYS to Qt/qt*/tools/mingw*/
2 Steps needed:
1: Edit /etc/profile and add these to export functions:
if [ $MSYSTEM == MINGW32 ]; then
export PATH=".:/usr/local/bin:/bin:/C/Qt/Qt5.2.1/Tools/mingw48_32/bin:/c/Qt/Qt5.2.1/5.2.1/mingw48_32/include":C:/Qt/Qt5.2.1/5.2.1/mingw48_32/bin:C:/Qt/Qt5.2.1/5.2.1/mingw48_32/include:$PATH"
else
export PATH=".:/usr/local/bin:/bin:/C/Qt/Qt5.2.1/Tools/mingw48_32/bin:/c/Qt/Qt5.2.1/5.2.1/mingw48_32/include":C:/Qt/Qt5.2.1/5.2.1/mingw48_32/bin:C:/Qt/Qt5.2.1/5.2.1/mingw48_32/include:$PATH"
fi
2. Edit ffstap example and put these:
#Win32_Path Mount_Point
c:/Qt/Qt5.2.1/Tools/mingw48_32 /mingw
c:/Qt /Qt
Now you can compile your app with unix style methots and use autotools and what so ever. You just download unix sourcecode for the apps and use make make install method to build your libraries and then you can use those in your QT project.
↧