Currently, the latest version of Qt is 5.2.1, CentOS is 6.5, and GCC is 4.8.2. after some attempts, we finally installed the Qt development environment in CentOS (64bit, there are several points to be aware of throughout the process. here we will sort them out for your reference. 1. upgrade GCCCentOS6.5 with the built-in GCC version 4.4, while Qt5.2.1 requires 4
Currently, the latest version of Qt is 5.2.1, CentOS is 6.5, and GCC is 4.8.2. after some attempts, we finally installed the Qt development environment in CentOS (64bit, there are several points to be aware of throughout the process. here we will sort them out for your reference.
1. upgrade GCC
The built-in GCC version of CentOS6.5 is 4.4, while Qt5.2.1 requires 4.8.2 support (supports C ++ 11 features). Therefore, you must upgrade GCC first.
GCC source package: http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.8.2/gcc-4.8.2.tar.bz2 (82 M)
After the download is complete, decompress:
# Tar-zxvf gcc-4.8.2.tar.bz2
# Cd gcc-4.8.2
GCC has three dependency packages (available in the/contrib/download_prerequisites file ):
MPFR = mpfr-2.4.2
Gmp-4.3.2 GMP =
Pc = mpc-0.8.1
If you install the SDK in a disconnected network environment, download and compile the three dependency packages in sequence based on the version number. otherwise, GCCmake may fail. If it is a networked environment, you can directly execute:./contrib/download_prerequisites in the GCC Directory. the script will automatically wget to these dependent packages and compile them.
After the dependent package is compiled and installed, you can start to compile GCC. before configure, you need to understand several compilation parameters:
Gcc Compilation parameters:
-- Prefix // The default gcc installation directory, it is best to install under the CentOS-6.5 to/usr, otherwise there may be problems
-- Enable-languages ages // specifies the language files that gcc can compile. each language is separated by commas (,), such as c, c ++, and java.
-- Disable-multilib // by default, gcc can compile the code into a 64-bit program on a 32-bit system, or compile the code into a 32-bit program on a 64-bit system, if this compilation option is added, the gcc cross-compilation function is disabled.
After understanding the meaning of the above parameters, you can understand the meaning of the following compilation Command:
./Configure -- enable-checking = release -- enable-extensions ages = c, c ++ -- disable-multilib
Make-j4 // this process takes 30 to 20 minutes, depending on the computer configuration. J4 is run in one of the four jobs to improve compilation efficiency.
Make install
After a long wait, GCC4.8.2 should be able to be installed under your CentOS. check that:
Gcc -- version
The gcc version and copyright information are returned:
Gcc (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. Thereis NO
Warranty; not even for MERCHANTABILITY or fitness for a participant purpose.
Note the following points:
GCC Compilation depends on GCC. it sounds quite contradictory, that is, the system must have a GCC version to compile the new version of GCC. It is like installing a RAR installation file packaged in the RAR package ~
When gmp, mpfr, and mpc are compiled, the specified installation path is customized. you need to add the following options when compiling GCC:
-- With-mpc = installation directory of the NMPC
-- With-mpfr = MPFR installation directory
-- With-gmp = installation directory of GMP
So far, we have compiled and installed GCC4.8.2, but have not replaced the linked library of the system:/usr/lib64/libstdc ++. so.6. continue to read the following...
2. install Qt
Qt for Linux64-bit can be downloaded from the official website, download, directly in the terminal to execute the installation file to enter the graphical interface according to the wizard to install, this process is extremely simple, do not need to repeat. The key is that after the installation, Qt must fail to start! The terminal prompts the following:
Failed to load core:/opt/Qt5.2.1/Tools/QtCreator/lib/qtcreator/plugins/QtProject/libCore. so: Cannot load library/opt/Qt5.2.1/Tools/QtCreator/lib/qtcreator/plugins/QtProject/libCore. so :(/usr/lib64/libstdc ++. so.6: version 'glibcxx _ 3.4.15 'not found (required by/opt/Qt5.2.1/Tools/QtCreator/lib/qtcreator/plugins/QtProject /.. /.. /. /libQt5CLucene. so.5 ))
We can see that the default GCC link library of CentOS has not been replaced. Therefore, the version of the link Library is incorrect. We recommend that you follow the steps below to complete the replacement:
Updatedb: create a file index to quickly search for all files in CentOS.
Locatelibstdc ++. so.6. search for the libstdc ++. so.6 file in CentOS. you can see that many file directories with the same name or similar names are listed on the terminal, so that you can understand the file directory.
Mv/usr/lib64/libstdc ++. so.6/usr/lib64/libstdc ++. so.6.bak. back up the original link Library first.
Mv/usr/local/lib64/libstdc ++. so.6.0.18/usr/lib64/libstdc ++. so.6.
After the file is replaced, start Qt:
Cd/opt/Qt5.2.1/Tools/QtCreator/bin/
./Qtcreator. sh
OK, all done!