How to install Qt 5.10 on CentOS6?

If you’ve read my post on how to install Qt 5.10 on Windows, you must have known the installation of Qt on Windows is not a trivial work. Installing Qt 5.10 on CentOS6 is also a bitter thing to do. First, you should know which version of gcc is needed by Qt 5.10 on CentOS6 and install the correct version of gcc in the first place. According to the Qt official document on supported platforms, if you want to install Qt 5.10 on CentOS 6 (x86_64), you should install GCC 4.9.1 first, whereas GCC 4.9.1 is included in the devtoolset-3 package. I have tried to download the source code of gcc and build from source but failed due to the memory requirements. I also could not find a place to provide the latest gcc binaries. So I resort to installing the devtoolset-3 package using yum:

yum install centos-release-scl-rh
yum install devtoolset-3-gcc devtoolset-3-gcc-c++
scl enable devtoolset-3 bash

After installing gcc4.9, I downloaded the Qt5.10.1 for Linux. The downloaded file is a large file named  qt-opensource-linux-x64-5.10.1.run. And strangely, it is an executable file under Linux. To run this file, you need to set up GUI environment first. Now if you run the downloaded file, you will get the warning:

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to ‘/tmp/runtime-root’ QXcbConnection: Could not connect to display

This is not a problem. The problem is the garbled characters on the Qt installation GUI. The unreadable characters are due to to the missing of fonts. You can resolve the garbled character problem by installing the fonts:

yum -y install fontforge

Here I remind you of a trick Qt plays to let user register an account and collect users’ privacy. At the beginning of the installation, there is an option to create an account using your email. That is optional and you can skip this step and continue the installation. It seems Qt cares about customers’ privacy. But  in the next step that selects the components to be installed, only “Tools” is selected by default. If you are not careful enough and click the “Next” button directly, only Qt creator is installed. The core development components such as the libraries and the headers are not installed at all. You may notice an executable file in the installation directory called MaintenanceTool which can be used to add/remove components after the initial installation. However after you realize most components have not been installed and you want to use the maintenance tool to add the core components later, you will find the the only usable option is “remove all components”. The other options such as “Add/Remove component” can not be used until you have an account and specify a repo. By this way, Qt successfully punishes those who did not create an account at the installation.

Finally, the installation completed. But the tragedy just started. If you run qtcreator, it will complain the error:

qtcreator: /lib64/libc.so.6: version `GLIBC_2.14′ not found (required by qtcreator)

While the file /lib64/libc.so.6 does exist, it is not the version qtcreator requires. The libc on my CentOS 6.5 is glibc-2.12, while the Qt Creator seems built with glib-2.14. Even the upgrading of gcc did not upgrade the glibc. Gcc and glibc are independent packages. By the way, according to this post, you should be cautious enough when updating glibc or gcc so as not to break the existing software on your system.  Until then, I found the minor version of CentOS mattered in this case. The Qt official document says Qt5.10 can be installed on CentOS6.6. I thought CentOS6.5 would be ok as well, which is proved wrong.

Sadly enough, I uninstalled the Qt5.10.1 and tried to install an old version Qt5.3.1 hoping this earlier version is built on GLibc-2.12. The bad thing is you can not know which version of glibc qt uses until you install it and run the program. The official document does not list the dependencies for every minor release of CentOS and Qt.

 

Posted in

Comments are closed, but trackbacks and pingbacks are open.