ubuntu安装QT

以QT5.15.14为例

下载地址:Index of /archive/qt

安装步骤:

  1. 解压qt-everywhere-src-5.15.14

  2. 运行:

    bash 复制代码
    cd qt-everywhere-src-5.15.14
    mkdir build
    cd build
    ../configure -prefix /opt/qt5.15.14 -opensource -confirm-license
    make -j16
    sudo make install

问题解答:

  1. 若出现如下错误:
bash 复制代码
ERROR: The OpenGL functionality tests failed!
You might need to modify the include and library search paths by editing QMAKE_INCDIR_OPENGL[_ES2],
QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your platform.

解决方式:

bash 复制代码
sudo apt-get install libgl1-mesa-dev

sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev
  1. 若出现如下问题 :
bash 复制代码
/usr/include/c++/11/type_traits:38:10: fatal error: bits/c++config.h: No such file or directory

解决方式:安装gcc-9版本,由于系统内存在多个版本gcc,可以使用update-manager进行管理

复制代码
sudo apt install update-manager
sudo apt install gcc-9 g++-9 gcc-9-multilib g++-9-multilib
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 1
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 1
  1. 若出现一下错误:
bash 复制代码
 ./configure -prefix $PWD/qtbase -opensource -nomake tests bash: ./configure:/bin/sh^M:解释器错误: 没有那个文件或目录 

解决方案:

bash 复制代码
#你可以使用dos2unix工具将文件的换行符从Windows风格转换为Unix/Linux风格

sudo apt-get install dos2unix
find . -type f -exec dos2unix {} \;
相关推荐
草莓熊Lotso2 分钟前
【CMake】 工程实战:可执行文件从编译、链接到安装全流程深度拆解
linux·运维·服务器·网络·c++·cmake
正点原子4 分钟前
【正点原子Linux连载】 第五章 字符设备驱动开发 摘自【正点原子】ATK-DLRK3568嵌入式Linux驱动开发指南
linux·运维·驱动开发
源远流长jerry6 分钟前
Linux内核之一条tcp到底占用多少内存
linux·运维·服务器·网络·网络协议·tcp/ip
肖坤超12 分钟前
Ubuntu 26.04 完美安装和设置
linux·运维·ubuntu
红茶要加冰21 分钟前
二、shell中的变量
linux·运维·shell
杨云龙UP24 分钟前
ODA/Oracle 19c CDB/PDB 环境下报错ORA-65162:common user密码过期问题排查与处理_2026-05-15
linux·运维·数据库·oracle·dba·db
wjykp29 分钟前
5.cypher语句组合与复杂操作
linux·前端·javascript
苏宸啊37 分钟前
磁盘结构、存储原理
linux
星河漫步Lu1 小时前
QT6中五步完成Android的环境配置
android·qt
小短腿的代码世界1 小时前
Qt状态机框架深度解析:从状态图到事件驱动闭环
开发语言·qt