Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use linuxdeployqt to package Qt programs in Ubuntu

Shulou Source: shulou.com Published: 2022-06-01 23:04:47 12月01日 Update

This article will explain in detail how to use linuxdeployqt in Ubuntu to package Qt programs. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.

1. Configure the Qt environment

First of all, let's configure the Qt environment and add it to ~ / .bashrc:

Export PATH=/home/xl/Qt5.9.2/5.9.2/gcc_64/bin:$PATHexport LD_LIBRARY_PATH=/home/xl/Qt5.9.2/5.9.2/gcc_64/lib:$LD_LIBRARY_PATHexport QT_PLUGIN_PATH=/home/xl/Qt5.9.2/5.9.2/gcc_64/plugins:$QT_PLUGIN_PATHexport QML2_IMPORT_PATH=/home/xl/Qt5.9.2/5.9.2/gcc_64/qml:$QML2_IMPORT_PATH

The / home/xl/Qt5.9.2/5.9.2/ directory should be modified according to the Qt path installed on your computer.

Then execute sourec ~ / .bashrc to make the configuration effective.

two。 Compile linuxdeployqt

Project address: https://github.com/probonopd/linuxdeployqt.git.

Although there is a release of the compiled package, because I am using Ubuntu18, the system version is too high, so I still choose to compile the code.

In order to avoid the problem that the compiled package runtime detects that our system version is too high and does not continue to execute, we comment out the following code in tools/linuxdeployqt/main.cpp before compilation:

/ / openSUSE Leap 15.0 uses glibc 2.26 and is used on OBS / * if (strverscmp (glcv, "2.27") > = 0) {/ / comment version check qInfo ()

Tags: Compile program system version directory error configuration code content copy article more comments environment knowledge article generate good address tool Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Linux vpn Shulou Information MySQL