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 {} \;
相关推荐
jzwalliser3 分钟前
Ubuntu的美化:深度定制指南
ubuntu·gnome·美化
yunwei372 小时前
eBPF 教程:精准隔离已建立的 TCP 连接
linux·安全·开源
weixin_445476682 小时前
linux下lims部署详细步骤参考
linux
奇特認4 小时前
数据库MySQL 1.安装环境部署
linux·运维·服务器
小小龙学IT4 小时前
Day 26-27 项目实战:从零构建一个高并发聊天室(epoll + 线程池)
linux·服务器·c语言·开发语言·网络
风静如云4 小时前
Yocto:关于Layer
linux
无足鸟ICT4 小时前
【RHCA+】for循环
linux
雨声不在4 小时前
vm.mmap_rnd_bits 引发 ASAN CPU 100% 问题解析
linux·服务器·网络
进击切图仔5 小时前
在 windows 和 ubuntu 中配置 host 文件
linux·windows·ubuntu
郭涤生5 小时前
C++ 零拷贝(Zero-Copy)
linux·开发语言·c++