简体   繁体   English

使用 Qt 5、C++ 和 Z5BD4C87976F48E402A53919D5EE 从 Linux 创建可执行文件

[英]Create Executable from Linux using Qt 5, C++ and OpenCV

I've been trying to deploy an executable version of my program, I tried in many ways as我一直在尝试部署我的程序的可执行版本,我尝试了很多方式

  1. Running it in release mode发布模式下运行它
  2. linuxdeployqt tool linuxdeployqt工具
  3. GitHub + Jenkins GitHub + Jenkins

but those hasn't worked for me, I can deploy the program in the development enviroment, but I need to install it in different computers.但那些对我不起作用,我可以在开发环境中部署程序,但我需要将它安装在不同的计算机上。 If if's possible to create the version for Windows (Because the university I developed it for is asking for it)如果可以为 Windows 创建版本(因为我开发它的大学要求它)

I'm using Qt 5.9.5, gcc 7.5.0, CMake 3.10.2, GDB 8.1.0, OpenCV 4.1.1 and SO Linux Mint 19.1 Tessa. I'm using Qt 5.9.5, gcc 7.5.0, CMake 3.10.2, GDB 8.1.0, OpenCV 4.1.1 and SO Linux Mint 19.1 Tessa.

I would suggest you to try using CQtDeployer from https://github.com/QuasarApp/CQtDeployer我建议您尝试使用来自https://github.com/QuasarApp/CQtDeployer的 CQtDeployer

You can find instalation guide in this video , even though it isn't in english language, everything is described step by step in there.您可以在此视频中找到安装指南,即使它不是英文的,但其中的所有内容都是逐步描述的。

Hope that would work for you.希望这对你有用。

How to deploy project with cqtdeployer.如何使用 cqtdeployer 部署项目。

  1. First one you need to install cqtdeployer into your platform第一个您需要将 cqtdeployer 安装到您的平台中

    • Snap (14 more linux destributions): Snap(另外 14 个 linux 分布):
     sudo snap install cqtdeployer

    Or或者

    Install from snap store and add all requirement permissions.从快照商店安装并添加所有要求权限。

    从 Snap 商店下载

     chmod +x LinuxInstaller.run./LinuxInstaller.run
  2. Build your project on release mode.在发布模式下构建您的项目。

  3. Deploy yor executable file.部署你的可执行文件。

    • For Linux systems:对于 Linux 系统:
     cqtdeployer -bin myexecutable
    • For Windows systems:对于 Windows 系统:
     cqtdeployer -bin myexecutable.exe -qmake C:/Qt/5.15.0/min_gw/bin/qmake.exe
    • For crossplatform build (Linux -> Windows)对于跨平台构建(Linux -> Windows)
     cqtdeployer -bin myexecutable.exe -qmake ~/crossbuildet-Qt/5.15.0/min_gw/bin/qmake

Extra options额外选项

If you use extra libraries.如果您使用额外的库。 just add path for cqtdeployer to used libs.只需将 cqtdeployer 的路径添加到使用的库中。

cqtdeployer -bin myexecutable -libDir /PathToMyExtraLibs 

If you want find libraryes recursive from libDir path, just add recursiveDepth option.如果您想从 libDir 路径中找到递归库,只需添加 recursiveDepth 选项。

cqtdeployer -bin myexecutable -libDir /PathToMyExtraLibs -recursiveDepth 5

If you application use qml, just add qmlDir option如果您的应用程序使用 qml,只需添加 qmlDir 选项

cqtdeployer -bin myexecutable -libDir /PathToMyExtraLibs -recursiveDepth 5 -qmlDir /path/to/my/qml/sources

If you want create simple installer for you application just add qif option.如果您想为您的应用程序创建简单的安装程序,只需添加 qif 选项。

cqtdeployer -bin myexecutable -libDir /PathToMyExtraLibs -recursiveDepth 5 -qmlDir /path/to/my/qml/sources qif

If you use system libraries from system PATH, just add deploySystem option.如果您使用系统 PATH 中的系统库,只需添加 deploySystem 选项。

Warning: snap version do not have permision to system files. 警告:快照版本没有系统文件的权限。 To deploy system libraries use the cqtdeployer version from the installer 要部署系统库,请使用安装程序中的 cqtdeployer 版本
cqtdeployer -bin myexecutable -libDir /PathToMyExtraLibs -recursiveDepth 5 -qmlDir /path/to/my/qml/sources qif deploySystem

If you have any problems with use cqtdeployer then ask you questions on the official github issues page .如果您在使用 cqtdeployer 时遇到任何问题,请在官方 github 问题页面上向您提问。

For more options of CQtDeploye see oficial documentation .有关 CQtDeploye 的更多选项,请参阅官方文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM