一、下载
Qt的官方下载地址:Qt Downloads
Qt 5.15.2源码下载路径:/archive/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.zip
二、编译源码
Qt官网提供了编译前需要安装的库及编译步骤:Building Qt 5 from Git
- 安装编译所依赖的库,主要是说一下xcb。
The xcb QPA platform plugin
Qt源码编译configure配置参数,模块相关的根据自己需要增加或裁剪,在Linux系统下,xcb QPA平台插件是必须要安装的。因为Qt 5.15版本以后在configure中没有-qt-xcb选项了,具体可见:
Qt Configure Options | Qt 5.15
可以直接使用下面的命令直接安装系统的xcb依赖项。
sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
-
安装好对应依赖库后,需要执行
rm config.cache
以删除之前缓存的配置,然后再次执行configure
。 -
依次执行 ./configure(生成makefile文件)、 make -j $(nproc)、 make install -j $(nproc)
configure 编译选项:
# config.sh
#! /bin/sh -e
./configure -confirm-license -opensource \
-prefix /home/nx/Qt \
-system-libjpeg \
-xcb
注意:
$(nproc)是指当前进程可用的CPU数目,$(nproc)和你的cpu核心数或超线程数相等即可,这个$(nproc)一定要写,如果只是make -j 可能导致系统资源耗尽。
更多推荐
Linux下Qt 5.15.2源码下载及编译
发布评论