当前位置:   article > 正文

ubuntn安装qt5.12.10_ubuntu1604安装qt.5.12.10

ubuntu1604安装qt.5.12.10

下载

http://download.qt.io/archive/qt/5.12/5.12.10/
在这里插入图片描述

第一次运行报错

Could not found load the Qt platform plugin “XCB” in “” even though it was found.

解决

sudo -s
sudo apt-get install libcap2-bin
sudo apt-get install --reinstall libxcb-xinerama0
  • 1
  • 2
  • 3

可以运行qtcoreator

编译时报错

1、cannot find -lGL

查看是否已安装
locate libGL
配置
sudo ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 /usr/lib/libGL.so
安装
sudo apt-get install mesa-common-dev
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev
如果安装不了,参考下一步中的替换apt源
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

2、缺少x11/xlib.h和xcb/xcb.h

sudo apt-get install libx11.dev
  • 1

安装时可能报错依赖库版本错误解决办法:

sudo gedit /etc/apt/sources.list
  • 1

该命令的作用是用gedit打开安装来源文件sources.list,替换安装源,使用阿里的云,将文件内容替换为以下内容

# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

执行

sudo apt-get update
sudo apt-get install libx11-dev
  • 1
  • 2

3、解决修改.pro文件保存时qt程序自动退出问题,主要受权限影响,修改权限即可。

4、18.04源

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
 
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
 
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
 
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
 
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

5、在Ubuntu上安装GCC

默认的Ubuntu存储库包含一个名为build-essential的元包,它包含GCC编译器以及编译软件所需的许多库和其他实用程序。

执行以下步骤安装GCC Compiler Ubuntu 18.04:

01、首先更新包列表:

sudo apt update

02、键入以下命令安装build-essential软件包:

sudo apt install build-essential

该命令将安装一堆新包,包括gcc,g ++和make。

03、要验证GCC编译器是否已成功安装,请使用gcc --version命令打印GCC版本:

gcc --version

Ubuntu 18.04存储库中可用的默认GCC版本是7.4.0

用到的指令
查看环境变量:env
临时指定链接库查找路径(多个路径可以用:隔开):
export LD_LIBRARY_PATH=LD_LIBRARY_PATH:.:~/Qt5.12.10/5.12.10/gcc_64/lib
内核版本:umame -a
增加库路径:
gedit /etc/ld.so.conf
增加路径即可

自动化安装脚本

#!/bin/sh
#install lib
#:<<!
echo "update apt"
sudo apt update
echo "install libcap2-bin"
sudo apt-get install libcap2-bin
echo "install libxcb-xinerama0"
sudo apt-get install --reinstall libxcb-xinerama0
echo "install mesa-common-dev"
sudo apt-get install mesa-common-dev
echo "install gl"
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev
#!
#install qt5.12.10
echo "install qt"
chmod 777 qt-opensource-linux-x64-5.12.10.run
./qt-opensource-linux-x64-5.12.10.run
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

export LD_LIBRARY_PATH=’/home/rdd/pp’:$LD_LIBRARY_PATH

export QT_DEBUG_PLUGINS=1

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/138540
推荐阅读
相关标签
  

闽ICP备14008679号