在Ubuntu 20.04上安装Qt 5.15.0
1 安装必要的依赖项:
sudo apt-get install build-essential \libgl1-mesa-dev \libglu1-mesa-dev \libegl1-mesa-dev \libgles2-mesa-dev \libxrandr-dev \libxext-dev \libxtst-dev \libxrender-dev \libxkbfile-dev \libsqlite3-dev \libssl-dev \libcurl4-openssl-dev \libicu-dev \libfontconfig1-dev \libfreetype6-dev \libinput-dev \libxcb1-dev \libx11-xcb-dev \libxcb-image0-dev \libxcb-keysyms1-dev \libxcb-shm0-dev \libxcb-icccm4-dev \libxcb-sync-dev \libglib2.0-dev \libpulse-dev \libavahi-client-dev \libavahi-core-dev \libsqlite3-dev \libdbus-1-dev \libxshmfence-dev \mesa-common-dev \g++ \gcc \make
2 下载Qt源代码:
wget http://download.qt.io/official_releases/qt/5.15/5.15.0/single/qt-everywhere-src-5.15.0.tar.xz
3 解压源代码:
tar xf qt-everywhere-src-5.15.0.tar.xz
4 进入解压后的Qt目录:
cd qt-everywhere-src-5.15.0
5 配置Qt(可以根据需要添加或修改配置选项):
./configure -prefix /usr/local/qt5.15.0 -opensource -confirm-license -nomake examples -nomake tests
6 编译并安装Qt:
make -j$(nproc)
make -j4 module-qtlocation
7 配置Qt环境变量:
echo 'export QTDIR=/usr/local/qt5.15.0' >> ~/.bashrc
echo 'export PATH=$QTDIR/bin:$PATH' >> ~/.bashrc
echo 'export MANPATH=$QTDIR/man:$MANPATH' >> ~/.bashrc
source ~/.bashrc
8 完成以上步骤后,Qt 5.15.0应该已经安装在您的Ubuntu 20.04系统上了。您可以通过运行qmake --version
来验证安装。
######################################