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 {} \;
相关推荐
l1x1n011 分钟前
Vim 编辑器常用操作详解(新手快速上手指南)
linux·编辑器·vim
Tony小周1 小时前
实现一个点击输入框可以弹出的数字软键盘控件 qt 5.12
开发语言·数据库·qt
ajassi20001 小时前
开源 python 应用 开发(三)python语法介绍
linux·python·开源·自动化
o不ok!2 小时前
Linux面试问题-软件测试
linux·运维·服务器
DaxiaLeeSuper2 小时前
Prometheus+Grafana+node_exporter监控linux服务器资源的方案
linux·grafana·prometheus
尽兴-3 小时前
如何将多个.sql文件合并成一个:Windows和Linux/Mac详细指南
linux·数据库·windows·sql·macos
kfepiza3 小时前
Netplan 中 bridges、bonds、ethernets、vlans 之间的关系 笔记250711
linux·tcp/ip·shell
小小不董3 小时前
深入理解oracle ADG和RAC
linux·服务器·数据库·oracle·dba
小宋0014 小时前
在Ubuntu上安装配置 LLaMA-Factory
ubuntu·计算机视觉
杰夫贾维斯5 小时前
CentOS Linux 8 的系统部署 Qwen2.5-7B -Instruct-AWQ
linux·运维·人工智能·机器学习·centos