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

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

问题描述

我成功地按照 Qt 文档中提到的所有步骤进行了操作:

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

    更新

    如果您想为您的应用程序创建一个简单的安装程序,只需为 cqtdeployer 的命令添加 qif 选项.示例:

    cqtdeployer -bin myApp -qmake path/to/Qt/5.xx/build/bin/qmake -qmlDir path/to/my/qml/files/dir奇夫

    可以在官方 wiki 项目中找到有关 cqtdeployer 所有复杂功能的详细信息.>

    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?

    解决方案

    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.

    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.

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

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