ZAC's Blog for sharing programming related stuffs, focus on free stuffs, occasionally will talk about paid solutions.
Translate
Showing posts with label mingw-builds. Show all posts
Showing posts with label mingw-builds. Show all posts
2014/01/03
Compile Qt 5.2.0 with ICU
Finally find a way to compile Qt 5.2.0 with ICU. It seems the PATH, LIBS and INCLUDE environment variable somehow being reset/ignore during the build process. So, in order to help the compiler and/or linker to find ICU libraries, I've copied all the ICU development files to Qt source tree and the compiler and/or linker now recognized the existence of ICU libraries and build Qt 5.2.0 shared version successfully with WebKit support.
2013/12/24
Compile QT 5.2.0
Instructions to build Qt
This is my own experimented instructions for building Qt 5.2.0 shared (debug and release) and static (release only) libraries which can be used to compile programs using dll and run on Windows XP SP3.Why build Qt by myself
The reason why I need to compile Qt by myself is that:- Qt 5.2.0 official version cannot compile programs using dll that can be run on Windows XP SP3 as the tool chains not import some code from msvcrt.dll and causing exception when deployed on Windows XP SP3 (at least for my own program and dll)
- Qt Creator 3.0.0 official version requires installation of Microsoft VC Runtime, as it seems to be built by Microsoft Visual C++, I need a portable version, preferred not to install anything before used
Require files to be downloaded:
In order to build Qt by yourself, you need to download the followings:- Qt5.2.0 (http://download.qt-project.org/official_releases/qt/5.2/5.2.0/single/qt-everywhere-opensource-src-5.2.0.zip)
- OpenSSL runtime (http://download.qt-project.org/development_releases/prebuilt/mingw_32/openssl-mingw-builds-runtime.7z)
- Python v2.7x or above (http://download.qt-project.org/development_releases/prebuilt/gdb/build-prerequisites/python.zip)
- MinGW (http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.8.2/threads-posix/sjlj/i686-4.8.2-release-posix-sjlj-rt_v3-rev1.7z/download)
- Perl(v5.14 or above) (http://www.activestate.com/activeperl/downloads/thank-you?dl=http://downloads.activestate.com/ActivePerl/releases/5.16.3.1603/ActivePerl-5.16.3.1603-MSWin32-x86-296746.msi)
Building Environment
The environment that I used to build are as follow:- Windows 7 Ultimate version
- UAC disabled (Otherwise, compilation may failed due to file access)
- Set Anti Virsus program to exclude the build directory and its sub-directory to speed up compilation (Also, some of the examples compiled will be identified as suspected malwares by say Symantec. If you are reluctant with this, add "-nomake examples" to the configure options).
Build directory structure
The directory structure that I used is as follow (originally want to have webkit built):z:\QtBuild
├─5.2.0
│ ├─mingw32
│ └─mingw32-s
├─bin
│ ├─mingw32
│ └─QtCreator
└─work
├─build
│ ├─mingw32
│ └─mingw32-s
└─tools
├─mingw32
├─perl
└─python
Preparation
- unzip MinGW (i686-4.8.2-release-posix-sjlj-rt_v3-rev1.7z) to z:\QtBuild\work\tools
- unzip MinGW (i686-4.8.2-release-posix-sjlj-rt_v3-rev1.7z) to z:\QtBuild\bin
- unzip python (python.zip) to z:\QtBuild\work\tools
- install perl (ActivePerl-5.16.3.1603-MSWin32-x86-296746.msi) to z:\QtBuild\work\tools
- unzip OpenSSL runtime (openssl-mingw-builds-runtime.7z) to z:\QtBuild\5.2.0\mingw32 and z:\QtBuild\5.2.0\mingw32-s
- unzip qt-everywhere-opensource-src-5.2.0.zip to z:\QtBuild\work\build then rename folder "qt-everywhere-opensource-src-5.2.0" to "mingw32"
- unzip again qt-everywhere-opensource-src-5.2.0.zip to z:\QtBuild\work\build then rename folder "qt-everywhere-opensource-src-5.2.0" to "mingw32-s" (if you want to build the static version)
- unzip qt-creator-opensource-src-3.0.0.zip to z:\QtBuild\work\build then rename folder "qt-creator-opensource-src-3.0.0" to "qtc-3.0.0"
- copy libgcc_s_sjlj-1.dll, libstdc++-6.dll and libwinpthread-1.dll from z:\QtBuild\work\tools\mingw32\bin to z:\QtBuild\5.2.0\mingw32
Patching files for static build
Skip this if you don't need static build.Open z:\QtBuild\work\build\mingw32-s\qtbase\mkspecs\win32-g++\qmake.conf with a text editor (e.g. Notepad)
Modify line 69 from
QMAKE_LFLAGS =to
QMAKE_LFLAGS = -Wl,-Bstatic -lwinpthread -static -static-libgcc -static-libstdc++and line 76 from
QMAKE_LFLAGS_DLL = -sharedto
QMAKE_LFLAGS_DLL = -Wl,-Bstatic -lwinpthread -static -static-libgcc -static-libstdc++
then save it.
Open z:\QtBuild\work\build\mingw32-s\qtbase\qmake\Makefile.win32 with a text editor
Modify line 50 from
LFLAGS =to
LFLAGS = -static -static-libgcc -static-libstdc++
then save it.
Building Qt (shared lib debug-and-release version)
This will build Qt shared libraries with sqlite, odbc, openssl, opengl desktop. For details of the configure options, please check with (http://qt-project.org/doc/qt-5/configure-options.html) or issue "configure.bat -platform win32-g++ --help" in Windows Command Prompt.Start a Windows Command Prompt and issue the following commands:
- set PATH="z:\QtBuild\work\build\5.2.0\mingw32\bin;z:\QtBuild\work\build\5.2.0\mingw32\qtbase\bin;z:\QtBuild\work\build\5.2.0\mingw32\qtrepotools\bin;z:\QtBuild\work\build\5.2.0\mingw32\gnuwin32\bin;z:\QtBuild\work\tools\mingw32\bin;z:\QtBuild\work\tools\mingw32\opt\bin;z:\QtBuild\work\tools\perl\bin;z:\QtBuild\work\tools\python;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;"
- set "MAKE_COMMAND="
- set "QMAKESPEC="
- set "QTDIR=" set "DXSDK_DIR="
- cd /d z:\QtBuild\work\build\mingw32
- configure.bat -confirm-license -opensource -prefix "z:\QtBuild\5.2.0\mingw32" -shared -debug-and-release -platform win32-g++ -qt-sql-sqlite -qt-sql-odbc -D _CRT_SECURE_NO_WARNINGS -mp -no-vcproj -opengl desktop -no-angle -no-icu -skip webkit -openssl
- cd /d z:\QtBuild\work\build\mingw32
- mingw32-make
Building Qt (static lib release version)
This will build Qt shared libraries with sqlite, odbc, openssl, opengl desktop. For details of the configure options, please check with (http://qt-project.org/doc/qt-5/configure-options.html) or issue "configure.bat -platform win32-g++ --help" in Windows Command Prompt.Start a Windows Command Prompt and issue the following commands:
- set PATH="z:\QtBuild\work\build\5.2.0\mingw32-s\bin;z:\QtBuild\work\build\5.2.0\mingw32-s\qtbase\bin;z:\QtBuild\work\build\5.2.0\mingw32-s\qtrepotools\bin;z:\QtBuild\work\build\5.2.0\mingw32-s\gnuwin32\bin;z:\QtBuild\work\tools\mingw32\bin;z:\QtBuild\work\tools\mingw32\opt\bin;z:\QtBuild\work\tools\perl\bin;z:\QtBuild\work\tools\python;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;"
- set "MAKE_COMMAND="
- set "QMAKESPEC="
- set "QTDIR=" set "DXSDK_DIR="
- cd /d z:\QtBuild\work\build\mingw32-s
- configure.bat -confirm-license -opensource -prefix "z:\QtBuild\5.2.0\mingw32-s" -static -release -platform win32-g++ -qt-sql-sqlite -qt-sql-odbc -D _CRT_SECURE_NO_WARNINGS -mp -no-vcproj -opengl desktop -no-angle -no-icu -skip webkit -openssl -nomake examples -nomake tests -qt-libpng -qt-libjpeg -qt-pcre -qt-freetype -qt-zlib -ltcg
- cd /d z:\QtBuild\work\build\mingw32-s
- mingw32-make
QtCreator 3.0.0
I've not built QtCreator 3.0.0 by myself as I always got a debug build instead of release one. So I used one of the prebuilt one (http://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/x32-Qt-5.2.0%2BQtCreator-3.0.0-%28gcc-4.8.2-dwarf%29.7z/download) I can find instead. The download also contain the qtbinpatcher.exe which is very useful for you to make your Qt tools set portable.- unzip x32-Qt-5.2.0+QtCreator-3.0.0-(gcc-4.8.2-dwarf).7z to z:\QtBuild\bin and then rename the folder "Qt-5.2.0-i686" to QtCreator.
Make it Portable
To deploy the Qt and QtCreator, you only need the 5.2.0 and bin folders. To make this portable, create a batch file say QtCreatorPortable.bat under z:\QtBuild with the following contents:@echo off
cls
if exist "%~dp05.2.0\mingw32\bin\qmake.exe" "%~dp0bin\QtCreator\qtbinpatcher.exe" --verbose --qt-dir="%~dp05.2.0\mingw32" --nobackup > NUL
if exist "%~dp05.2.0\mingw32-s\bin\qmake.exe" "%~dp0bin\QtCreator\qtbinpatcher.exe" --verbose --qt-dir="%~dp05.2.0\mingw32-s" --nobackup > NUL
if exist "%~dp0tools\QtCreator\bin\qmake.exe" "%~dp0bin\QtCreator\qtbinpatcher.exe" --verbose --qt-dir="%~dp0tools\QtCreator" --nobackup > NUL
start /b "" "%~dp0bin\qtCreator\bin\qtCreator.exe" -settingspath "%~dp0\bin\data"
NOTE:
After starting QtCreator, you need to go to "tools -> options -> Build and Run" to change the settings in order to reflect the tool chains location.OR
You could download my QtCreatorPortable.exe (https://drive.google.com/file/d/0B4DEiRGyVMoTT2VaLUFhTDJpVUU/edit?usp=sharing) and the initial settings data (https://drive.google.com/file/d/0B4DEiRGyVMoTQ0ktSkxFaTBUVU0/edit?usp=sharing) to ease the job. Unzip data.7z to z:\QtBuild\bin and save QtCreatorPortable.exe to z:\QtBuild. Just double the QtCreatorPortable.exe and it will use the qtbinpatcher.exe to patch the Qt libraries, update the settings and then start QtCreator. The assumption are as follow:
- Qt libraries are resided in .\5.2.0\mingw32 and/or .\5.2.0\mingw32-s
- QtCreator is resided in .\bin\QtCreator
- qtbinpatcher.exe is resided in .\bin\QtCreator
- QtCreator setting files in .\bin\data
ENJOY QT
References:
http://qt-project.org/wiki/MinGW-64-bithttp://qt-project.org/wiki/How-to-build-a-static-Qt-for-Windows-MinGW
2013/11/14
[#solved] #Build #Qt5.1.1 #failed again (Makefile.Debug:7091: recipe for target '.obj/debug_shared/qwindowstheme.o' failed)
Find a patch for the file qtbase\src\plugins\platforms\windows\qwindowstheme.cpp.
Need to try again.
Need to try again.
#Build #Qt5.1.1 #failed again (Makefile.Debug:7091: recipe for target '.obj/debug_shared/qwindowstheme.o' failed)
Follow the MinGW 64 bit wiki post, I try to build dependent libraries myself before building Qt5.1.1 again.
After applying the patch, I have run into another problem "Makefile.Debug:7091: recipe for target '.obj/debug_shared/qwindowstheme.o' failed".
After applying the patch, I have run into another problem "Makefile.Debug:7091: recipe for target '.obj/debug_shared/qwindowstheme.o' failed".
[#Solved] #Building #Qt5.1.1 static failed (Makefile:350: recipe for target 'qfilesystemengine_win.o' failed)
Finally found a patch on web to solve the issue.
You can download the patch from here.
The file to be patched is <qt-5.1.1-Folder>/qtbase\src/corelib/io/qfilesystemengine_win.cpp
Hope this time the compile can get through.
You can download the patch from here.
The file to be patched is <qt-5.1.1-Folder>/qtbase\src/corelib/io/qfilesystemengine_win.cpp
Hope this time the compile can get through.
2013/11/07
Building Qt5.1.1 static failed (Makefile:350: recipe for target 'qfilesystemengine_win.o' failed)
Building Qt5.1.1 failed again. Stopped during creating qmake.
Makefile:350: recipe for target 'qfilesystemengine_win.o' failed
Building qmake failed, return code 2
Building platform:
- Windows Server 2008 R2
- DirectX SDK 2010 June
- MinGW-builds (gcc-4.8.1-dwarf-rev5)
- ActivePerl-5.16.3.1603-MSWin32-x86-296746
- python-3.3.2
- ruby-1.9.3-p448
Building environment:
- DXSDK_DIR=Z:\QtBuild\tools\msdxsdk
- INCLUDE=.;Z:\QtBuild\tools\3rdparty\libicu\include;Z:\QtBuild\tools\3rdparty\openssl\include;Z:\QtBuild\tools\3rdparty\libmysql\include;\include;Z:\QtBuild\tools\msdxsdk\include
- LIB=.;Z:\QtBuild\tools\3rdparty\libicu\lib;Z:\QtBuild\tools\3rdparty\openssl\lib;Z:\QtBuild\tools\3rdparty\libmysql\lib;\lib;Z:\QtBuild\tools\msdxsdk\Lib\x86
- PATH=;Z:\QtBuild\5.1.1\src\qtbase\bin;Z:\QtBuild\5.1.1\src\qtrepotools\bin;Z:\QtBuild\tools\gnuwin32\bin;Z:\QtBuild\tools\mingw-builds\mingw32\bin;Z:\QtBuild\tools\perl\bin;Z:\QtBuild\tools\ruby\bin;Z:\QtBuild\tools\python\bin;Z:\QtBuild\tools\cmake\bin;Z:\QtBuild\tools\utils;Z:\QtBuild\tools\msdxsdk\Utilities\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
- from
- QMAKE_LFLAGS =
- QMAKE_LFLAGS_DLL = -shared
- to
- QMAKE_LFLAGS = -static -static-libgcc
- QMAKE_LFLAGS_DLL = -static -static-libgcc
Configure option:
- cd /d Z:\QtBuild\5.1.1\src\
- Z:\QtBuild\5.1.1\src\configure.bat -confirm-license -opensource -platform win32-g++ -release -static -ltcg -prefix Z:\Qt\5.1.1\mingw481_32s -qt-sql-sqlite -qt-sql-odbc -plugin-sql-sqlite -plugin-sql-odbc -qt-zlib -qt-libpng -qt-libjpeg -opengl desktop -qt-freetype -no-angle -no-qml-debug -nomake tests -nomake examples -skip qtwebkit -icu -openssl-linked -qt-sql-mysql -plugin-sql-mysql -no-vcproj
2013/11/05
Qt configure failed
Using mingw-builds to compile Qt 5.1.1 failed with configure error in configure.bat file.
./configure.bat: line 1: @echo: command not found
./configure.bat: line 2: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: command not found
./configure.bat: line 3: ::: command not found
./configure.bat: line 4: syntax error near unexpected token `('
./configure.bat: line 4: `:: Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).'
Really don't understand what's going wrong.
It's time to abolish mingw-builds and follow the official building procedures on Windows.
It's time to abolish mingw-builds and follow the official building procedures on Windows.
Solving mingw-builds script download error
Using #mingw-builds to build #Qt, if encounter download error from #http://sf.net , you can download the corresponding file manually and place it inside Qt-builds/work/src/, then create an empty file with <yourDownloadFilename>.marker inside Qt-builds/work/markers/. Re-run ./buildall <yourOptions> will continue the process.
Labels:
build,
compile,
download,
error,
MinGW,
mingw-builds,
Qt,
sf.net,
solved,
sourceforge.net
Subscribe to:
Posts (Atom)