turn from: http://www.cnblogs.com/oloroso/p/5407779.html
Compiling QT is a tricky thing to do. So if it's not necessary, don't compile it. If you only need to use some of the basic functions of QT, then just compile the source directory under the Qtbase directory of Things.
All of the following are only applicable to Linux (Windows use MinGW can also be, QT provides MINGW installation package is 32-bit, need 64-bit can refer to).
Before compiling, it is best to install the dependent package, mainly XCB/OPENGL, etc. The compiler uses GCC5 and above versions faster. i5-4460 CPU @ 3.20ghz+8g Memory compile time is about 2.5 hours.
At compile time the disk space requirement is very very big 75G./qt-src/qt-opensource-src-5.6.0 (This is the case that has not been fully compiled), if not acceptable, do not compile the debug version and examples.
To provide a good one that I've already compiled.
Linux 64-bit GCC compilation
Http://pan.baidu.com/s/1eRMnf26 Extract Password iz39
64-bit MinGW compilation under Windows
Http://pan.baidu.com/s/1qYh7yGG Extract Password 6bur
Because the installation path has been hard-coded into the qmake (using strings qmake|grep qt_ to view) when compiling.
So if you change the installed directory, you need to create a file qt.conf in the bin directory under the installation directory, which reads as follows:
[Paths]
Prefix = Installation Path
First download the source package qt-everywhere-opensource-src-5.6.0.7z
and unzip it.
7z x-o/home/o/qt-src/qt-opensource-src-5.6.0 qt-everywhere-opensource-src-5.6.0.7z
cd/home/o/qt-src/ qt-opensource-src-5.6.0
I extract it into the/home/o/qt-src/qt-opensource-src-5.6.0 and unpack it into this directory. Configure generation Makefile
First, use the./configure--help to see what the parameters are, here is not to paste the command output, directly to the options are translated installation options
Options |
function |
-prefix <dir> |
Specify the deployment directory (default/usr/local/qt-5.6.0) |
-extprefix <dir> |
installation directory (default Sysroot/prefix) |
-hostprefix [dir] |
The installation directory of the build tools running on this host, if not given, use the current directory. (Default Extprefix) |
You can use these to change the layout of the installation. Please note that all directories except Sysconfdir, others should be located under-prefix/hostprefix
Options |
function |
-bindir <dir> |
User executable files will be installed in this directory (default Prefix/bin) |
-headerdir <dir> |
Header file installation directory (default prefix/include) |
-libdir <dir> |
Library file installation directory (default prefix/lib) |
-archdatadir <dir> |
QT-related data will be installed to <dir> (default PREFIX) |
-plugindir <dir> |
Plugin installation directory (default archdatadir/plugins) |
-libexecdir <dir> |
Executable file installation directory for the program (default Archdatadir/libexec, Archdatadir/bin for MinGW) |
-importdir <dir> |
Import QML1 installation directory (default archdatadir/imports) |
-qmldir <dir> |
Import QML2 installation directory (default ARCHDATADIR/QML) |
-datadir <dir> |
QT Independent Data installation directory (default PREFIX) |
-docdir <dir> |
Document installation directory (default Datadir/doc) |
-translationdir <dir> |
The QT program's translation Data installation directory (default datadir/translations) |
-sysconfdir <dir> |
Set up a search directory using the QT program (default PREFIX/ETC/XDG) |
-examplesdir <dir> |
Sample file installation directory (default prefix/examples) |
-testsdir <dir> |
Test file installation directory (default prefix/tests) |
-hostbindir <dir> |
Host executable file installation directory (default Hostprefix/bin) |
-hostlibdir <dir> |
Host library file installation directory (default hostprefix/lib) |
-hostdatadir <dir> |
Qmake using the Data installation directory (default Hostprefix) |
Configure Options
The * in the first column of the table below indicates the default and feasible. + Represents the default, but needs to be evaluated (tested) for evaluation to be accepted.
|
option |
action |
* |
-release |
Compiling and linking the release version of QT |
|
-debug |
Compiling and linking the debug version |
|
-debug-and-release |
Compile and link release and debug two versions of QT. No and have debug output (Mac only) |
|
-force-debug-info |
Force build output debugging information for release |
|
-developer-build |
QT Developer compile and link options (including automated test/output) |
* |
-no-optimized-tools |
Optimized host tools are not built even in debug builds |
|
-optimized-tools |
Build optimized host tools, even in debug versions |
|
-opensource |
Compiling and linking QT Open source version |
|
-commercial |
Compiled and linked QT Business Edition |
|
-confirm-license |
Automatically confirm license (using open source or commercial) |
|
-C++STD <edition> |
Compile the C + + standard used by QT (c++98, c++11, c++14, c++1z) default: Highest supported version |
* |
-shared |
Create and use Qt shared libraries. |
|
-static |
Create and use QT static libraries |
|