QT安装

  1. 先安装qt的依赖库
    sudo apt-get install bison build-essential gperf flex ruby python libasound2-dev libbz2-dev libcap-dev
    libcups2-dev libdrm-dev libegl1-mesa-dev libgcrypt11-dev libnss3-dev libpci-dev libpulse-dev libudev-dev
    libxtst-dev gyp ninja-build libglu1-mesa-dev libfontconfig1-dev libx11-xcb-dev libicu-dev

依赖库版本过高处理:
Depends: libcups2 (= 2.1.3-4) but 2.1.3-4ubuntu0.5 is to be installed

sudo aptitude install bison build-essential gperf flex ruby python libasound2-dev libbz2-dev libcap-dev
libcups2-dev libdrm-dev libegl1-mesa-dev libgcrypt11-dev libnss3-dev libpci-dev libpulse-dev libudev-dev
libxtst-dev gyp ninja-build libglu1-mesa-dev libfontconfig1-dev libx11-xcb-dev libicu-dev

询问是否依然按当前高版本依赖库进行qt安装
Accept this solution? [Y/n/q/?] n

进行版本安装
Accept this solution? [Y/n/q/?] y

安装需要一定数量的内存,是否继续
Do you want to continue? [Y/n/?] y

不安装这些依赖库接下来运行configure的时候可能会报如下错误

WARNING: gperf is required to build QtWebEngine.

WARNING: bison is required to build QtWebEngine.

WARNING: flex is required to build QtWebEngine.

WARNING: host pkg-config not found

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.

如果发生类似这样的错 安装完相关依赖库之后 记得运行 rm config.cache来删除缓存的配置

  1. 下载qt源码

git clone git://code.qt.io/qt/qt5.git

  1. 进入qt5目录

  2. perl init-repository 初始化库和克隆子模块的变量

  3. 执行./configure -shared -opensource -nomake examples -nomake tests -confirm-license -prefix /usr/local/qt

    -prefix表示指定依赖文件的目录,需先检查/usr/local目录下是否有qt文件,如果没有则表示qt的依赖文件直接安装在/usr/local目录下,不需要指定
    ./configure -shared -opensource -nomake examples -nomake tests -confirm-license
    
  4. make

  5. make install


原文:https://blog.csdn.net/wahaha13168/article/details/82721209?utm_source=copy

你可能感兴趣的:(install)