如何为Linux部署Qt应用程序 [英] How to deploy Qt applications for Linux

查看:585
本文介绍了如何为Linux部署Qt应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我成功完成了Qt文档中提到的所有步骤:

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

但是我仍然不能创建静态Qt应用程序,通过上述步骤生成的可执行文件仍然需要其他系统上的Qt共享对象.

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.

有什么想法吗?

推荐答案

您需要部署应用程序,为此,我使用了该实用程序 cqtdeployer

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.

您可以从 github 版本(Windows)进行安装

You can install from github releases (Windows)

来自快照存储区(Linux)

sudo snap install cqtdeployer

您可以使用以下方式:

  • 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-这是qmake用来构建程序的方式.

      • 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-这是直接到您的qml文件(您编写的)的路径

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

        然后使用sh脚本(Linux)或exe(Windows)运行应用程序

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

        如果要使用snap的版本,请确保拥有所有权限.

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

        如果您需要使用Windows版本,只需从安装程序安装应用程序

        If you need use windows version just install application from installer

        这篇关于如何为Linux部署Qt应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆