Install Qt5.15 on ubuntu20.04

Table of contents

work before installation

Choose which version of QT to install

Which components to choose during installation

 Install Qt5.15

Install online

components of my choice

Source package installation

test


work before installation

ubuntu20.04.3 install Qt6.22 operation steps_ubuntu install qt6_sonicss Blog

# 安装g++、gcc编译器
sudo apt-get install build-essential

Install libgl1-mesa-dev, the OpenGL library, to prevent Qt from appearing when compiling the project:

/usr/bin/ld: cannot find -lGL错误

After the installation is complete, enter gcc -v in the console to view the version number, mine is 9.4

lrj@lrj-HLY-WX9XX:/etc/apt/keyrings$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-Av3uEd/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1) 

Choose which version of QT to install

Features and choices between QT4, 5, and 6 versions_Differences between qt5 and qt6_Crazy excavator's blog-CSDN blog

 

I chose version 5.15 , because the Tsinghua image has:

https://mirrors.tuna.tsinghua.edu.cn/qt/official_releases/qt/5.15/5.15.10/single/But
an error was reported during installation

Which components to choose during installation

Install QT5.14.2 under Ubuntu20

 

The two in the red box are mandatory. If you find it troublesome, you can check them all. It’s okay to install more points.

  • Desktop gcc 64-bit This is a 64-bit Qt library pre-compiled by Qt.
  • Developer and Designer Tools This is our protagonist QtCreator

 

 Install Qt5.15

Ubuntu18.04 installation and configuration Qt5.15_ubuntu installation qt5.15_Pan Xiaohui's blog-CSDN blog

Use the domestic mirror source to install QT online (2023.3.25 update)_qt domestic mirror_Iotfsd's Blog-CSDN Blog

For ordinary users, after Qt5.15, all open source versions no longer provide offline installation, and can only be installed online, or use static compilation. The installation packages for two different installation methods are given below.
Online installation package
source package

Install online

Online installation is recommended for two reasons:

  • Online installation can choose QT version when installing
  • Online installation avoids complicated source code compilation process (I personally think that some software source code installation is a kind of torture in China, such as opencv)

Click on the online installation package above to download the installation package

Then grant execute permission:

sudo chmod a+x qt-unified-linux-x64-4.6.0-online.run

Run the installer:

./qt-unified-linux-x64-4.6.0-online.run --mirror https://mirror.nju.edu.cn/qt  

Then I forgot the password of my qt account, and the website could not be loaded after changing the password, it hurts, it hurts too much

In the process of tossing, I changed the password of the qt account with my mobile phone. Yes, I can change it with my mobile phone.

components of my choice

Qt Design Studio is a tool for creating interactive user interfaces (UI        )

DEsktop Source must be selected

Qt Creator is an integrated development environment (IDE), dedicated to the development of Qt application     IDE

CMake is a cross-platform build tool used to generate build files for different operating systems and compilers. 

Ninja is an efficient build tool, mainly used to build code. Let's install it, it's not bad for this little space , although I didn't use it before

 

title

 

The command to run the installer specifies Aliyun, which is very fast

 

After installation, I found out that Qt Design Studio actually doesn’t need to be installed, because there is UI design in QT Creator

Source package installation

The compilation process is a bit cumbersome and will not be updated for the time being

test

Click on this icon in the lower left corner:

 

Click on the QT Creator icon:

 

In the QT Creator interface, click File, click New Project, select Non-Qt Project in the left column, and select Plain C++ Application in the right column

 

Build system selection CMake:

 Ctrl + R runs the following code:

 According to the execution results in the above figure, this Qt installation can run C++ code without any problem!

 

This is the end of this record, if you encounter any problems, please leave a message below!

Many thanks also to the authors of the blogs referenced in this article for their articles!

Guess you like

Origin blog.csdn.net/weixin_45824067/article/details/131970558