Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
764 views
in Technique[技术] by (71.8m points)

c++ - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...