Detailed tutorial on installing qt5.12.8 and environment configuration on ubuntu18.04

Detailed tutorial on installing qt5.12.8 and environment configuration on ubuntu18.04

insert image description here

After the installation is complete, you can find Qt Creator in your application.

insert image description here

Configuring environment variables

You need to configure the environment variables before you can use the qmake command directly
In Ubuntu, for all users, edit the /etc/profile file

sudo vim /etc/profile

Add at the end (Note: the path here corresponds to the installation path, please check whether yours corresponds)

export PATH="/opt/Qt5.12.8/Tools/QtCreator/bin:$PATH"
export PATH="/opt/Qt5.12.8/5.12.8/gcc_64:$PATH"

After the modification is complete, restart the system or use "source /etc/profile" or ". /etc/profile" to make the modification take effect. The source command is also called the "dot command", which is a dot symbol (.). The source command is usually used to re-execute the initialization file that has just been modified to make it take effect immediately without having to log out and log in again.

Enter qtcreator in the terminal to open Qt Creator directly

qtcreator

3. QT project test

Let's create a new Qt project to test it
File>>New File or Project, select Qt Widgets Application. For testing purposes, you can basically click Next all the way, and you can delete the project later.

insert image description here

The built test project

insert image description here

Add a textBrowser control to mainwindow.ui and write a standard greeting

insert image description here

Run >>>>>>>>>>>>>>>>> Error... As the saying goes, "A journey of a hundred steps begins with the halfway point", it has come to this point, hurry up and find a way to solve it

insert image description here

Found the reason

By default, Qt searches for dynamic link libraries in the /usr/lib/ directory, but many Linux distributions place OpenGL link libraries in other directories. For example, I use CentOS 7, and the OpenGL link library is located in the /usr/lib64/ directory, while for Ubuntu, the OpenGL link library is located in the /usr/lib/i386-linux-gnu/mesa/ directory. As long as we copy libGL.so to the /usr/lib/ directory, or create a link for libGL.so in the /usr/lib/ directory, the problem can be solved. Obviously the second method is better.
In addition, the OpenGL link library that comes with the Linux distribution has a version number added to the suffix, such as libGL.so.1, libGL.so.1.2.0, libGL.so.1.3.1, etc., but the OpenGL link library that Qt looks for during the linking phase does not have a version number.

In summary, we need Create a link for the OpenGL library in the /usr/lib/ directory and remove the version number.

If you don't know the specific path of libGL.so in the current Linux system, you can use the locate libGL command or find /usr -name libGL* command to find it, and then use ln -s to create a link. Follow the method:
#Find the location of libGL

# locate libGL
/usr/lib/x86_64-linux-gnu/libGL.so.1
/usr/lib/x86_64-linux-gnu/libGL.so.1.0.0
/usr/lib/x86_64-linux-gnu/libGLESv2.so.2
/usr/lib/x86_64-linux-gnu/libGLESv2.so.2.0.0
......

#Create a link. There may be multiple versions of libGL.so in the Linux system. Just create a link for any version. Ordinary users do not have permission to create links. Use the root user or sudo command.

#sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/libGL.so

Run again>>>>>>>>>>>>>>> Success

insert image description here

Summarize

This is the end of this article about the detailed tutorial on how to install qt5.12.8 and environment configuration on ubuntu18.04. For more information about how to install qt5.12.8 and environment configuration on ubuntu, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed steps for installing, configuring and uninstalling QT5 in Ubuntu 14.04
  • How to install and uninstall pyqt5 in ubuntu
  • How to install Qt5.10 on Ubuntu 18.04

environment

System: Ubuntu 18.04
Software: qt5.12.8

1. Download the installation package

Download address: http://download.qt.io/archive/qt/5.12/5.12.8/

insert image description here

Click the required version (here we choose .run) and you will be redirected to a source selection interface. You can choose one of the three sources in China (CN).

insert image description here

2. Installation

Enter the download folder from the terminal, usually /home/username/Downloads, and you can find the downloaded qt-opensource-linux-x64-5.12.8.run
Grant executable permissions to all users for qt-opensource-linux-x64-5.12.8.run

sudo chmod a+x qt-opensource-linux-x64-5.12.8.run

After you have the permission, you can execute it under this path

./qt-opensource-linux-x64-5.12.8.run

The installation guide window pops up. Fill in the QT Account according to the instructions (I remember that there were previous versions that could be skipped). Click Next all the way. It is not recommended to modify the default path.

insert image description here

Install as needed, and configure enough to select all to save trouble.

<<:  Token verification login in Vue project (front-end part)

>>:  Tutorial on how to connect and use MySQL 8.0 in IDEA's Maven project

Recommend

Implementation example of Vue+Element+Springboot image upload

Recently, I happened to be in touch with the vue+...

SQL query for users who have placed orders for at least seven consecutive days

Create a table create table order(id varchar(10),...

Centos7 installation of FFmpeg audio/video tool simple document

ffmpeg is a very powerful audio and video process...

Understanding and using callback functions in JavaScript

Table of contents Overview What are callbacks or ...

In-depth explanation of MySQL user account management and permission management

Preface The MySQL permission table is loaded into...

How to import/save/load/delete images locally in Docker

1. Docker imports local images Sometimes we copy ...

js realizes packaging multiple pictures into zip

Table of contents 1. Import files 2. HTML page 3....

Implementation of iview permission management

Table of contents iview-admin2.0 built-in permiss...

Implementation of Nginx load balancing cluster

(1) Experimental environment youxi1 192.168.5.101...

Detailed explanation of the benefits of PNG in various network image formats

BMP is an image file format that is independent o...

A brief introduction to MySQL storage engine

1. MySql Architecture Before introducing the stor...

Steps to install MySQL 5.7.10 on Windows server 2008 r2

Install using the MSI installation package Downlo...

MySQL 8.0.20 installation and configuration detailed tutorial

This article shares with you a detailed tutorial ...

A brief discussion on JS packaging objects

Table of contents Overview definition Instance Me...