Install Qt 5 on Ubuntu(使用qt-opensource-linux-x64-5.7.0.run进行安装,而且是官方的wiki)
Introduction
This is a tutorial for installation of Qt 5.7.0 to Ubuntu 12.10. It may be used also for newer versions of Qt and Ubuntu. A difference for OpenGL has been found and added as a note below.
Installation Guide
- Download
Visit Qt downloads page an download a 32-bit or 64-bit Linux installation depending your version of Ubuntu. The installation file can be also downloaded through the command line using wget.
Example:
wget http://download.qt.io/official_releases/qt/5.7/5.7.0/qt-opensource-linux-x64-5.7.0.run
- Install
Adjust permission, run the installer and follow the instruction to complete the installation.
chmod +x qt-opensource-linux-x64-5.7.0.run
./qt-opensource-linux-x64-5.7.0.run
- Install g++
Open a terminal and execute the following command to install g++:
sudo apt-get install build-essential
- Install generic font configuration library - runtime
Open a terminal and execute the following command to install the full runtime files for the generic font configuration library:
sudo apt-get install libfontconfig1
- Configure a compiler
Launch Qt Creator. Go to Tools > Options. Click Build & Run and select tab Kit. Configure a compiler if it is not automatically detected.
- Install OpenGL libraries
Execute the following command to install OpenGL libraries:
sudo apt-get install mesa-common-dev
Note: Just installing the above-mentioned mesa-common-dev kit is not sufficient for more recent Ubuntu versions. Based on a comment in the Qt forum[1] an additional package needs installation. Execute following command:
sudo apt-get install libglu1-mesa-dev -y
Tested with Qt5.3.1 and Ubuntu 14.04 and it solved the problem with missing -lGL.
- Set file association with pro files
When installing from the on-line source the file association is not done automatically. It also not show up when you try to associate it with file explorer. Create a file named “Qt-Creator.desktop” and fill the file with the following.
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=QtCreator
Comment=QtCreator
NoDsiplay=true
Exec=(Install folder of QT)/Tools/QtCreator/bin/qtcreator %f
Icon=(Install folder of QT)/5.4/Src/qtdoc/doc/images/landing/icon_QtCreator_78x78px.png
Name[en_US]=Qt-Creator
Place this file in home .local/share/applications .
Edit a file named “defaults.list” in the same directory . Add the following line.
text/qtcreator=Qt-Creator.desktop;
open file mimeapps.list and check if the following line is present.
application/vnd.nokia.qt.qmakeprofile=qtcreator.desktop
if not add it under [added Associations].
Run the following command.
sudo update-mime-database /usr/share/mime
now Qt has been added to the list of file associations.
Troubleshooting
- Qt Creator needs a compiler set up to build
Follow the instruction from the previous section to configure compiler for Qt Creator.
- error: g++: Command not found
Solution:
sudo apt-get install build-essential
- error: GL/gl.h: No such file or directory
Solution:
sudo apt-get install mesa-common-dev
References
- Jump up↑ Qt 5.5.0 problem running examples [SOLVED]. 2015-09-22. Archived from the original on 2016-08-01. Retrieved 2016-08-01.
Execute the following command to install OpenGL libraries: sudo apt-get install mesa-common-dev Note: Just installing the above-mentioned mesa-common-dev kit is not sufficient for more recent Ubuntu versions. Based on this comment in the forum an additional package needs installation. Execute following command: sudo apt-get install libglu1-mesa-dev -y Tested with Qt5.3.1 and Ubuntu 14.04 and it solved the problem with missing -lGL.
原文地址: http://wiki.qt.io/Install_Qt_5_on_Ubuntu
https://blog.csdn.net/zbc415766331/article/details/80832943
相关文章
- Linux Sed使用场景详解,轻松解决日常工作需求
- Jenkins打包Gitlab代码发布到远程Linux服务器
- Linux 有问必答: 如何在红帽系linux中编译Ixgbe驱动
- Linux 上网络监控工具 ntopng 的安装
- Linux系统配置ssh监听多个端口方法
- 解决qt程序运行时的cannot create Qt for Embedded Linux data directory: /tmp/qtembedded-0出错情形
- Linux 远程数据同步工具详解
- 【QT】对于Qt MSVC 2017无法编译的问题解决
- 【权限提升】Linux Sudo权限提升漏洞(CVE-2023-22809)
- Linux设备驱动——接口与总线
- Qt音视频开发38-USB摄像头解码linux方案
- Linux多线程实例练习 - pthread_exit() 与 pthread_join()
- Linux打包免安装的Qt程序(编写导出依赖包的脚本copylib.sh,程序启动脚本MyApp.sh)
- linux中ip和防火墙
- Linux常用基本命令:tr-替换或者删除字符
- Linux 如何将linux主机变为路由器&&iptables的基本用法
- Linux基础:系统启动过程(5个阶段)、linux关机正确流程及常用实例命令、linux目录结构(常见目录解释及目录的分类介绍)
- 【正点原子Linux连载】第六章 Qt Creator的使用技巧 摘自【正点原子】I.MX6U嵌入式Qt开发指南V1.0.2
- 【正点原子Linux连载】第二十四章 智能家居物联网项目 摘自【正点原子】I.MX6U嵌入式Qt开发指南V1.0.2
- 【正点原子MP157连载】第二十九章 Linux按键输入实验-摘自【正点原子】STM32MP1嵌入式Linux驱动开发指南V1.7
- 【历史上的今天】2 月 22 日:Red Hat Enterprise Linux 问世;BASIC 语言作者出生;计算机协会创始人诞生
- 【Linux】linux经常使用基本命令
- Linux学习笔记(13)linux软件安装rpm与yum--理论篇
- Linux学习笔记(1)linux的开关机及重启