简体   繁体   English

Qt-如何在Linux上动态部署应用程序?

[英]Qt - How to deploy application dynamically on Linux?

I have an application that I built using Qt Creator on Linux and want to deploy it now. 我有一个使用Qt Creator在Linux上构建的应用程序,现在想部署它。 However, I don't want to statically build it as I don't want it to be open-sourced. 但是,我不想静态构建它,因为我不想将其开源。 I tried the ldd ./YourExecutable command, however that only lists (and not add) the additional dependencies the application needs in order for it to run. 我尝试了ldd ./YourExecutable命令,但是该命令仅列出(而不添加)应用程序运行所需的其他依赖项。 My question is, how do I gather the necessary dependencies without having to individually look for these files? 我的问题是,如何在不必单独查找这些文件的情况下收集必要的依赖关系? Is there a tool, such as windeployqt.exe on Windows, that I can use on Linux for the same purpose? 是否可以在Linux上出于相同目的使用诸如Windows上的windeployqt.exe之类的工具? Or is there a better approach than the one I'm thinking of? 还是有比我正在考虑的方法更好的方法?

  1. Get Cygwin setup.exe: http://www.cygwin.com/ 获取Cygwin setup.exe: http//www.cygwin.com/

1.1. 1.1。 Run setup.exe and continue to package selection list. 运行setup.exe,然后继续选择软件包列表。

1.2. 1.2。 Under Devel catagory select tools you need for compiling your source. 在“开发类别”下,选择编译源所需的工具。 For example 'GNU make'. 例如“ GNU make”。

1.3. 1.3。 Finish installing. 完成安装。

  1. Get linux crosscompilers for cygwin: "cygwin-gcc-linux.tar.bz2" (68.2 Mb). 获取cygwin的linux交叉编译器:“ cygwin-gcc-linux.tar.bz2”(68.2 Mb)。 md5sum: 340e91a346f5bb17e660db10e43005b8 md5sum:340e91a346f5bb17e660db10e43005b8

    These compilers are made with crosstool 0.28-rc37. 这些编译器使用crosstool 0.28-rc37制作。 This package contains: gcc-3.3.4 and gcc-2.95.3 for i386 (glibc 2.1.3) and gcc-3.3.3 for amd64 (glibc 2.3.2). 该软件包包含:用于i386(glibc 2.1.3)的gcc-3.3.4和gcc-2.95.3和用于amd64(glibc 2.3.2)的gcc-3.3.3。

    Note! 注意! There is now newer version of GCC avaible with glibc 2.3.2: "cygwin-gcc-3.3.6-glibc-2.3.2-linux.tar.bz2 (i386, x86_64)". 现在有了glibc 2.3.2可用的较新版本的GCC:“ cygwin-gcc-3.3.6-glibc-2.3.2-linux.tar.bz2(i386,x86_64)”。

2.1. 2.1。 Copy 'cygwin-gcc-linux.tar.bz2' to 'c:\\cygwin' or install directory which you selected in setup.exe. 将“ cygwin-gcc-linux.tar.bz2”复制到“ c:\\ cygwin”或安装在setup.exe中选择的目录。

2.2. 2.2。 Open Cygwin shell and change directory to root with 'cd /'. 打开Cygwin Shell,将目录更改为以'cd /'为根目录。

2.3. 2.3。 Uncompress to Cygwin root with command: 'tar -jxvf cygwin-gcc-linux.tar.bz2'. 使用命令“ tar -jxvf cygwin-gcc-linux.tar.bz2”解压缩到Cygwin根目录。

Cross-compilers are installed under '/opt/crosstool'. 交叉编译器安装在“ / opt / crosstool”下。 You can use theim directly or with commands: gcc-linux, g++-linux, gcc-linux-2.95, g++-linux-2.95, gcc-linux-x86_64 and g++-linux-x86_64. 您可以直接使用theim或通过以下命令使用它们:gcc-linux,g ++-linux,gcc-linux-2.95,g ++-linux-2.95,gcc-linux-x86_64和g ++-linux-x86_64。

From: Cross-compiling on Windows for Linux More info here . 来源: 在Windows交叉编译的Linux更多的信息在这里

It sounds like you want to use the shared library deployment option: 听起来您想使用共享库部署选项:

http://doc.qt.io/qt-5/linux-deployment.html#creating-the-application-package http://doc.qt.io/qt-5/linux-deployment.html#creating-the-application-package

Then if you wanted to go further than that, you could look into making a .rpm or a .deb . 然后,如果您想进一步发展,可以考虑制作.rpm或.deb。

There are lots of examples of qt projects that are now available on GitHub and have packages made. 现在有很多qt项目的示例可以在GitHub上获得,并且已经制作了软件包。 Usually for prebuilt binaries you need to make one for x86 and a separate one for x64. 通常,对于预编译的二进制文件,您需要为x86创建一个,为x64创建一个单独的。

Hope that helps. 希望能有所帮助。

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

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