Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy Qt applications for Linux

I followed all the steps successfully as mention in the Qt documentation:

But I still couldn't make static Qt application, the executable generated by the above documented steps still needs Qt shared objects on other system.

Any ideas?

like image 813
Ankit Rawat Avatar asked Jan 16 '17 10:01

Ankit Rawat


People also ask

Does Qt support Linux?

Qt's support for different Linux platforms is extensive and mature. To download and install Qt for Linux, follow the instructions on the Getting Started with Qt page.

How do I deploy Qt application on Raspberry Pi?

Re: How to deploy qt applications in raspberrypi 1) Build your Qt application with statically linked Qt libraries. 2) Use the normal shared Qt libraries and package your program as a Raspbian package, . deb, that uses the Raspbian Qt libs. 3) Use normal shared Qt libraries but package them with your executable, in a .


1 Answers

You need to deploy the application, for this purpose I use the utility cqtdeployer

This utility itself collects all the necessary dependencies of your application and you do not have to spend your time on it, or you can automate this process.

You can install from github releases (Windows)

or

from snapstore (Linux)

sudo snap install cqtdeployer

You can use as follows:

  • Windows:
%cqtdeployer% -bin myApp -qmake path/to/Qt/5.x.x/build/bin/qmake.exe -qmlDir path/to/my/qml/files/dir
  • Linux:
cqtdeployer -bin myApp -qmake path/to/Qt/5.x.x/build/bin/qmake -qmlDir path/to/my/qml/files/dir
  • path/to/Qt/5.x.x/build/bin/qmake - This is the way qmake is used to build your program.

  • path/to/my/qml/files/dir - this is the path directly to your qml file (which you wrote)

And Run application with sh script (Linux) or exe (Windows)

If you'll use the version from snap then make sure that you have all the permissions. cqtdeployer

If you need use windows version just install application from installer

Updated

If you want create a simple installer for you application just add qif option for command of cqtdeployer. Example :

cqtdeployer -bin myApp -qmake path/to/Qt/5.x.x/build/bin/qmake -qmlDir path/to/my/qml/files/dir qif

Details on all the intricacies of cqtdeployer can be found on the official wiki project.

like image 143
Andrey Yankovich Avatar answered Oct 01 '22 16:10

Andrey Yankovich