如何为所有UNIX版本Qt应用程序? [英] How to create a qt application for all unix versions?

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

问题描述

我已经能够创建依赖于WebKit和脚本Qt5.2.1.But我能够创建一个deb包14.04版本的Ubuntu。但我怎么可以把它作为独立。我已经看到静态单独的应用程序的应用程序和动态的构建。我试过静电积聚,但我不KON▼如何,包括静态build.Also WebKit是有可能与共享库的方式创建一个独立的application.Please帮我在这里。

I have been able create an application that depends on webkit and scripts in Qt5.2.1.But i was able to create a deb package for 14.04 version Ubuntu .But how can i make it as stand alone application .I have seen static and dynamic build .I tried static build but I don't kon w how to include webkit for static build.Also is it possible with shared library approach for creating a standalone application.Please help me out here..

推荐答案

部署动态链接Qt应用程序:

您应该将这样的Qt文件一起可执行文件的发布版本。这些是 libQtCore.so libQtGui.so 并有可能为那些你已经使用的其他模块。这些所谓的文件是在lib文件夹中的Qt安装目录或目录 / usr / lib目录/ I386-Linux的GNU 。如果你正在使用的插件,你应该把自己这么一个文件名为插件您身边的二进制文件夹中。在使用图标和图像的情况下,你应该在文件夹中船这样的文件,如 libqico.so libqsvg.so 名为 imageformats

You should place Qt so files along the release version of your executable. These are libQtCore.so, libQtGui.so and possibly the ones for other modules that you have used. These so files are in your installed Qt directory in lib folder or in the directory /usr/lib/i386-linux-gnu. If you are using plugins you should place their so files in a folder named plugins beside your binary. In case of using icons and images you should ship their so files like libqico.so and libqsvg.so in a folder named imageformats.

收集所需的共享库:

如果您希望您的应用程序的裸露安装了Linux独立运行,你应该收集所有相关共享库,并把它们在你的应用程序目录。你可以简单地由名为 CPLD 一个shell脚本做到这一点。您可以轻松地所有依赖复制到文件夹。

If you want your application to run independently on a bare installed Linux, you should gather all dependent shared libraries and put them in your application directory. You can simply do it by a shell script named cpld. You can easily copy all dependencies to a folder.

这是值得注意的,你可以把这个在你的.pro文件,使动态链接程序在同一目录看作在运行在Linux中的Qt应用程序:

It's worthy to note that you can put this in your .pro file to cause the dynamic linker to look in the same directory as your Qt application at runtime in Linux :

unix:{
    # suppress the default RPATH if you wish
    QMAKE_LFLAGS_RPATH=
    # add your own with quoting gyrations to make sure $ORIGIN gets to the command line unexpanded
    QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN\'"
}

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

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