文章目录
概要 资源下载 依赖安装 编译
遇到的问题 qtchooser 使用
概要
自 Qt 5.15 开始,不再提供 open source offline installers,也就是原来的 .run 的安装文件,只能通过源码编译来安装了 参考文章
资源下载
wget https://download.qt.io/official_releases/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.tar.xz
wget https://download.qt.io/official_releases/qt/6.5/6.5.3/single/md5sums.txt
md5sum qt-everywhere-opensource-src-6.5.3.tar.xz
tar -xvf qt-everywhere-opensource-src-6.5.3.tar.xz
cd qt-everywhere-src-6.5.3/
依赖安装
sudo apt install bison build-essential flex gperf libasound2-dev libatkmm-1.6-dev libbz2-dev libcap-dev libcups2-dev libdrm-dev libegl1-mesa-dev libfontconfig1-dev libfreetype6-dev libglu1-mesa-dev libicu-dev libnss3-dev libpci-dev libpulse-dev libssl-dev libudev-dev libx11-dev libx11-xcb-dev libxcb-composite0 libxcb-composite0-dev libxcb-cursor-dev libxcb-cursor0 libxcb-damage0 libxcb-damage0-dev libxcb-dpms0 libxcb-dpms0-dev libxcb-dri2-0 libxcb-dri2-0-dev libxcb-dri3-0 libxcb-dri3-dev libxcb-ewmh-dev libxcb-ewmh2 libxcb-glx0 libxcb-glx0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-image0 libxcb-image0-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-present-dev libxcb-present0 libxcb-randr0 libxcb-randr0-dev libxcb-record0 libxcb-record0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-render0 libxcb-render0-dev libxcb-res0 libxcb-res0-dev libxcb-screensaver0 libxcb-screensaver0-dev libxcb-shape0 libxcb-shape0-dev libxcb-shm0 libxcb-shm0-dev libxcb-sync-dev libxcb-sync1 libxcb-util-dev libxcb-util0-dev libxcb-util1 libxcb-xf86dri0 libxcb-xf86dri0-dev libxcb-xfixes0 libxcb-xfixes0-dev libxcb-xinerama0 libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xkb1 libxcb-xtest0 libxcb-xtest0-dev libxcb-xv0 libxcb-xv0-dev libxcb-xvmc0 libxcb-xvmc0-dev libxcb1 libxcb1-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxext-dev libxfixes-dev libxi-dev libxrandr-dev libxrender-dev libxslt1-dev libxss-dev libxtst-dev perl ruby python-is-python2 llvm libclang-dev zstd dbus libpango1.0-dev libcogl-pango-dev libjpeg-dev libdbus-1-dev libdbus-glib-1-dev
sudo apt install libfontconfig1-dev libfreetype6-dev libx11-dev libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync0-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxkbcommon-dev libxkbcommon-x11-dev
编译
Qt5
./configure
sudo make -j8
sudo make install
Qt6
sudo cmake --build . --parallel
sudo cmake --install .
遇到的问题
编译QT5时遇到报错Project ERROR: Library 'assimp' is not defined. make[4]: *** [Makefile:85:sub-assimp-install_subtargets] 错误 3
解决方案思路 修改改路径下文件
为以下内容
qtchooser
sudo apt install qtchooser
qtchooser -install qt5.15.11 /usr/local/Qt-5.15.11/bin/qmake
sudo vim /etc/profile
export QT_SELECT = qt5.15.11
使用
打开QtCreator,添加好qmake
即可使用