1、下载源码:
wget https://download.qt.io/archive/qt/5.14/5.14.2/single/qt-everywhere-src-5.14.2.tar.xz
wget https://download.qt.io/archive/qtcreator/4.11/4.11.1/qt-creator-opensource-src-4.11.1.tar.xz
2、解压
tar -xvf qt-everywhere-src-5.14.2.tar.xz
tar -xvf qt-creator-opensource-src-4.11.1.tar.xz
3、配置并编译QT5.14.2:
3.1、在源码同级目录新建src_build目录(避免污染源码)
3.2、在src_build目录下新建auto_configure.sh脚本文件并写入以下内容:
#!/bin/bash
../qt-everywhere-src-5.14.2/configure \
-prefix /usr/local/qt5.14.2 \
-release \
-opensource \
-confirm-license \
-nomake examples \
-nomake tests \
-skip qtwebengine \
-skip qtvirtualkeyboard \
-skip qtquick3d \
-xcb
3.3、终端中执行auto_configure.sh脚本
3.4、编译,很慢,规划好时间(64核心、需要3小时左右)
make -j$(nproc)
3.5、安装
make install
错误处理:
执行auto_configure.sh文件如果报错:ERROR: Feature 'xcb' was enabled, but the pre-condition 'features.thread && features.xkbcommon && libs.xcb' failed. 需要安装libxcb和libxkbcommon
yum install libxcb*
yum install ibxkbcommon*
安装完成后,把src_build下除auto_configure.sh外的所有文件删除,重新执行auto_configure.sh文件