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

Where is mysql data stored?

MySQL database storage location: 1. If MySQL uses...

Linux CentOS 6.5 Uninstall, tar and install MySQL tutorial

Uninstall the system-provided MySQL 1. Check whet...

How to introduce Excel table plug-in into Vue

This article shares the specific code of Vue intr...

MySQL 5.7.33 installation process detailed illustration

Table of contents Installation package download I...

CSS margin overlap and how to prevent it

The vertically adjacent edges of two or more bloc...

Detailed steps for using AES.js in Vue

Use of AES encryption Data transmission encryptio...

Significantly optimize the size of PNG images with CSS mask (recommended)

This article is welcome to be shared and aggregat...

Detailed process of building nfs server using Docker's NFS-Ganesha image

Table of contents 1. Introduction to NFS-Ganesha ...

Introduction to Kubernetes (k8s)

I had always wanted to learn Kubernetes because i...

Detailed explanation of Linux index node inode

1. Introduction to inode To understand inode, we ...

Use of hasOwnProperty method of js attribute object

Object's hasOwnProperty() method returns a Bo...

Application of HTML and CSS in Flash

Application of HTML and CSS in Flash: I accidental...

Detailed tutorial on installing mysql 8.0.20 on CentOS7.8

1. Install MySQL software Download and install My...

Example code for implementing anti-shake in Vue

Anti-shake: Prevent repeated clicks from triggeri...