Building Qt 5.4.2 and ICU / CADSWES / June 2015
Phil Weinstein, Original Draft: 6-9-2015. Edit: 6-10-2015 (a) [PDF]
Document home:
R:\doc\Qt\2015\BuildingQt5-June2015.html (and .pdf).
This document describes the process of acquiring and building Qt 5.4.2 (MSVC 2010, 64-bit, debug and release) and supporting tools for the purpose of porting RiverWare and other CADSWES Qt applications from Qt 4.8.5 to Qt 5.
This includes:
This lacks:
Contents:
Document Status / Revision History:
Related CADSWES Documents:
Once the ICU and Qt 5 builds become part of our development tools, the following document should be revised to reflect information in this document:
Building Libraries and Executables Supporting RiverWare
R:\windows\config\BuildingRiverWareRelatedSoftware.docx
Most recent revision: 10-24-2014.
The following Qt reference pages are useful:
Also, I have put aside these README and HELP files, here:
Possible Improvements to our Qt5 Build Implementation
I won't here provide comprehensive instructions for these installations. We don't need to build these from source code -- just the normal binary installations for Windows are used.
Those three components are installed at these locations:
Installation Directory | Added to Path: | Where* |
C:\Perl64\ | C:\Perl64\site\bin;C:\Perl64\bin; | beginning |
C:\Python34\ | C:\Python34\;C:\Python34\Scripts; | beginning |
C:\Ruby193\ | C:\Ruby193\bin; | end |
*This is just where I had these on my path for my successful Qt 5.4.2 build.
Perl Conflict: Unfortunately, Qt requires a more advanced version of Perl, version 5.12 or later, than for which Perl/Tk is available. We need to stick with Perl 5.6.1 to support our internal tools using Perl/Tk, e.g. the RiverWare regression tests. (Newer Perl versions lack Perl/Tk because a maintainer was no longer available). I installed a 64-bit version of Perl 5.20.2 -- just to build Qt.
Python: The Qt5 build technically requires only Python 2.7 or later. Even though Python 2 and Python 3 are slightly different languages, Python 3 (version 3.4.0) apparently does work for the Qt5 build. We use Python 3.4 for processing RPL Predefined Function help content for RiverWare. (And I believe all of our Windows development machines currently have this). See the following document:
Notably, this Qt 5.4.2 build does NOT make use of the following 3rd party graphics driver libraries, required for Qt Quick 2 / QML:
"ICU (International Components for Unicode) is a mature, widely used set of C/C++ and Java libraries providing Unicode and Globalization support for software applications. ICU is widely portable and gives applications the same results on all platforms and between C/C++ and Java software. ICU is released under a nonrestrictive open source license that is suitable for use with both commercial software and with other open source or free software." [http://site.icu-project.org/].
Having ICU installed, and distributing ICU run time components, is a requirement for Qt WebKit in Qt5. It is also used by other Qt components, when present, and is expected to become a broader requirement (i.e. not just for Qt WebKit) in subsequent Qt5 versions.
ICU will be added as a standard component of our RiverWare build system. The following are instructions for obtaining and building ICU from source.
Any ZIP file extraction tool should do. I have 7-Zip installed on my Windows 7 machine.
The resulting folder, C:\Riverware\tools\icu-55.1, has the full ICU source tree. We will be building that in place. At this point (before the build) this folder has the following statistics. (Right click on the folder name, and select Properties ...):
Browse the C:/Riverware/tools/icu-55.1/readme.html webpage.
Even though the bin64 directory under that ICU folder does not yet exist, the instructions call for adding that bin directory to your system PATH before building ICU. Note that that readme.html file refers to this as just the "bin" directory. But for 64-bit, it is bin64. You might as well also make similar additions to the include and lib environment variables at this point.
So, in your Control Panel >> System >> Advanced system settings (requires an administrator account, e.g. .\Gomer Piles, and password) ... Environment Variables ... System variables:
System Environment Variable | Value |
ADD to Path: | C:\Riverware\tools\icu-55.1\bin64 |
ADD to (or create) include: | C:\Riverware\tools\icu-55.1\include |
ADD to (or create) lib: | C:\Riverware\tools\icu-55.1\lib64 |
The remaining instructions in the C:/Riverware/tools/icu-55.1/readme.html webpage -- How To Build and Install on Windows -- are pretty clear.
There is a Microsoft Visual Studio "all in one" solution (SLN) file which works nicely in Visual Studio 2010: C:\Riverware\tools\icu-55.1\source\allinone\allinone.sln.
Since the environment variables are all set up (done above), you should be able to run ICU's self tests:
At this point, the C:\Riverware\tools\icu-55.1 folder has the following statistics. (Right click on the folder name, and select Properties ...):
NOTE: An alternative to having the license file in the proper place is to type in the following information from that license file when prompted by the "configure" script (later on in the build process, see below). The following two lines from the license file are required: (a) Licensee (for me that's "Weinstein Phil", without the quotes), and (b) Qt5LicenseKey (that looks like: XXXX-XXX-XXX-XXX-XXXXX-XXXXX-XXXX).
Any ZIP file extraction tool should do. I have 7-Zip installed on my Windows 7 machine.
The resulting folder, C:\Riverware\tools\Qt-542, has the full Qt source tree. We will be building that in place. At this point (before the build) this folder has the following statistics. (Right click on the folder name, and select Properties ...):
The Qt5 build (in particular for Qt WebKit) also requires Bison, GPerf, and Flex. Versions of these GNU utilities are part of the Qt5 source code distribution, in a single directory. All that we need to do for these is to add C:\Riverware\tools\Qt-542\gnuwin32\bin to the end of the path.
As mentioned in prior sections, the path, include, and lib system environment variables are accessible from: Control Panel >> System >> Advanced system settings (requires an administrator account, e.g. .\Gomer Piles, and password) ... Environment Variables ... System variables. The following table reflects the content of these variables specifically used by the Qt5 build:
System Environment Variable | Value |
Path (towards beginning) | C:\Perl64\site\bin; C:\Perl64\bin; C:\Python34\; C:\Python34\Scripts; |
Path (towards the end) | C:\Ruby193\bin; C:\Riverware\tools\icu-55.1\bin64; C:\Riverware\tools\Qt-542\gnuwin32\bin; |
include | C:\Riverware\tools\icu-55.1\include |
lib | C:\Riverware\tools\icu-55.1\lib64 |
ALSO: It is (or, at least, may be) important to REMOVE our Unix Utilities from the path during the Qt5 Build Configuration and Build (nmake) process:
System Environment Variable | REMOVE Value |
Path | C:\RiverWare\tools\UnxUtils; |
This is done by executing the Qt5 "configure" script within a Visual Studio x64 Win64 Command Prompt (2010). On a machine with Visual Studio 2010 installed, this command window is available from the Start Menu >> All Programs >> Microsoft Visual Studio 2010 >> Visual Studio Tools >> Visual Studio x64 Win64 Command Prompt.
Open one of these up, and type:
Very big deal: Carefully type (copy and paste) this -- all one line:
NOTE: The following comment generated from "configure" -- "To reconfigure, run nmake confclean and configure" -- turns out to be incorrect; this is not actually supported in Qt5. (It's apparently left over from Qt4). To redo the configuration, I ended up unpacking the original source into a fresh C:\Riverware\tools\Qt-542 build directory.
NOTE: The configure command for our prior Qt build (for Qt 4.8.5) also had the following switches which are no longer used in Qt5. When we subsequently do a production build of Qt5 -- i.e. not just for the purpose of Qt4-to-Qt5 porting work -- we will want to review the full set of configure switches used -- and not used. I'm particularly concerned about the removal of the -no-exceptions switch.
NOTE: The "-no-opengl -no-angle" switches were added to resolve the following error message, generated from "configure" -- see following. (I believe we don't currently need OpenGL support).
If your Qt Commercial license isn't installed -- see step III-A -- the configure script will prompt for the following information (my responses are underlined):
Running configure (see above) took about only one minute. The following is the last part of the output to the console:
... ... ... Microsoft (R) Incremental Linker Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved. copy qmake.exe C:\Riverware\tools\Qt-542\qtbase\bin\qmake.exe 1 file(s) copied. Running configuration tests... Environment: Configuration: pcre debug compile_examples QPA Backends: GDI.....................yes Direct2D................no Third Party Libraries: ZLIB support............qt GIF support.............plugin JPEG support............plugin PNG support.............yes FreeType support........yes Fontconfig support......no HarfBuzz support........qt PCRE support............qt ICU support.............yes ANGLE...................no Dynamic OpenGL..........no Styles: Windows.................yes Windows XP..............yes Windows Vista...........yes Fusion..................yes Windows CE..............no Windows Mobile..........no Sql Drivers: ODBC....................no MySQL...................no OCI.....................no PostgreSQL..............no TDS.....................no DB2.....................no SQLite..................plugin (qt) SQLite2.................no InterBase...............no Sources are in..............C:\Riverware\tools\Qt-542\qtbase Build is done in............C:\Riverware\tools\Qt-542\qtbase Install prefix..............C:\Riverware\tools\Qt-542\qtbase Headers installed to........C:\Riverware\tools\Qt-542\qtbase\include Libraries installed to......C:\Riverware\tools\Qt-542\qtbase\lib Arch-dep. data to...........C:\Riverware\tools\Qt-542\qtbase Plugins installed to........C:\Riverware\tools\Qt-542\qtbase\plugins Library execs installed to..C:\Riverware\tools\Qt-542\qtbase\bin QML1 imports installed to...C:\Riverware\tools\Qt-542\qtbase\imports QML2 imports installed to...C:\Riverware\tools\Qt-542\qtbase\qml Binaries installed to.......C:\Riverware\tools\Qt-542\qtbase\bin Arch-indep. data to.........C:\Riverware\tools\Qt-542\qtbase Docs installed to...........C:\Riverware\tools\Qt-542\qtbase\doc Translations installed to...C:\Riverware\tools\Qt-542\qtbase\translations Examples installed to.......C:\Riverware\tools\Qt-542\qtbase\examples Tests installed to..........C:\Riverware\tools\Qt-542\qtbase\tests Info: creating super cache file C:\Riverware\tools\Qt-542\.qmake.super Qt is now configured for building. Just run nmake. To reconfigure, run nmake confclean and configure. C:\Riverware\tools\Qt-542> |
Note: It's best to capture and save to a text file the content of the console having the Qt build configuration report (as shown above).
As noted above "nmake confclean" doesn't actually work for preparing to re-run the configure script; that is apparently left over from Qt4.
Here are some metrics from this 64-bit build, compared to a similar build (also with Qt WebKit) for Qt 4.8.5:
C:\Riverware\tools\Qt-485 | 8.99 GB (9,657,989,499 bytes) | 63,184 Files | 7,380 Folders |
C:\Riverware\tools\Qt-542 | 14.2 GB (15,348,694,767 bytes) | 156,602 Files | 19,682 Folders |
Experimental RiverWare / Microsoft Visual Studio 2010 make files were created to test the Qt5 build. Adjustments to RiverWare source code were not made, so, of course, there are many compilation errors. Considering though, this went very well. By far, most of the required changes will be very simple. The make file changes are summarized below. This was also put away on a temporary "RwQt5" Git branch (see the topmost commit):
RiverWare Build Changes: Makefiles/qmake.pl:
Old | my $qt4 = 'C:\\RiverWare\\tools\\Qt-485'; |
New | my $qt4 = 'C:\\RiverWare\\tools\\Qt-542'; |
Old | my $cmd = "qmake $pro"; |
New | my $cmd = "C:/Riverware/tools/Qt-542/qtbase/bin/qmake $pro"; |
RiverWare Build Changes: Makefiles/riverwarebase.pro:
Old | QT += webkit |
New | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets lessThan(QT_MAJOR_VERSION, 5): QT += webkit greaterThan(QT_MAJOR_VERSION, 4): QT += webkitwidgets greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport |
Here are some representative source code problems for a Qt5 build of RiverWare -- (all of this seems relatively minor).
See the Qt5 Porting Guide and its linked topics [http://doc.qt.io/qt-5/portingguide.html] -- AND Transition from Qt 4.x to Qt5 [https://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5].
Building Qwt (our Qt plotting package) with Qt5 is a significant effort. We are currently using Qwt 5.2.3. Porting this to Qt5 ourselves and ensuring that it is working properly may not be easy, and the result isn't ideal. We would need to maintain our "customized" (ported) Qwt code in a source code repository (e.g. Git). It would be better for us to upgrade to Qwt 6.1 -- that's the first version of Qwt intended to be used with Qt5. While this is not a minor upgrade, there are benefits. For example, Qwt 6.1 allows us to implement our own plot curve legends. Additional plot and scale types too.
--- (end) ---