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 {} \;
相关推荐
Johny_Zhao3 小时前
Docker + CentOS 部署 Zookeeper 集群 + Kubernetes Operator 自动化运维方案
linux·网络安全·docker·信息安全·zookeeper·kubernetes·云计算·系统运维
小毛驴8504 小时前
Linux 后台启动java jar 程序 nohup java -jar
java·linux·jar
一心0925 小时前
ubuntu 20.04.6 sudo 源码包在线升级到1.9.17p1
运维·ubuntu·sudo·漏洞升级
好好学习啊天天向上5 小时前
世上最全:ubuntu 上及天河超算上源码编译llvm遇到的坑,cmake,ninja完整过程
linux·运维·ubuntu·自动性能优化
tan180°6 小时前
MySQL表的操作(3)
linux·数据库·c++·vscode·后端·mysql
典学长编程6 小时前
Linux操作系统从入门到精通!第二天(命令行)
linux·运维·chrome
wuk9987 小时前
基于MATLAB编制的锂离子电池伪二维模型
linux·windows·github
程序员爱钓鱼9 小时前
【无标题】Go语言中的反射机制 — 元编程技巧与注意事项
开发语言·qt
snoopyfly~9 小时前
Ubuntu 24.04 LTS 服务器配置:安装 JDK、Nginx、Redis。
java·服务器·ubuntu
独行soc9 小时前
#渗透测试#批量漏洞挖掘#HSC Mailinspector 任意文件读取漏洞(CVE-2024-34470)
linux·科技·安全·网络安全·面试·渗透测试