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 {} \;
相关推荐
come1123444 分钟前
剪映零基础教程
java·linux·运维
飘忽不定的bug2 小时前
ubuntu20.04交叉编译QT5.15.12(RK3562+ubuntu20.04)
linux·qt·ubuntu
库玛西2 小时前
深入浅出Linux select网络模型:从底层位图原理到C++面向对象高级封装
linux·服务器·网络·c++·ubuntu
Tingjct2 小时前
线程详细讲解---聚焦linux
linux·服务器·jvm
ComputerInBook2 小时前
linux包管理工具——yum(YellowdogUpdaterModified)
linux·运维·服务器·yum·dnf
霸道流氓气质2 小时前
通义千问 Chat 模型高级用法:Function Calling / Structured Output / 多轮对话
linux·运维·windows
实心儿儿2 小时前
Linux —— epoll(1)
linux·网络
s_w.h2 小时前
【 计网 】序列化与反序列化
linux·服务器·网络·算法·bash
祖力553 小时前
网络编程:IO多路复用(select、poll、epoll)
linux·服务器·网络
迷路爸爸1803 小时前
在 Ubuntu / Linux 上轻量安装 LaTeX:TinyTeX 使用记录
linux·运维·ubuntu