[英]Deploying Qt console application with QtPlugin
The context : 上下文 :
I'm currently working on a multiplatform server-side console application using Qt. 我目前正在使用Qt开发多平台服务器端控制台应用程序。 I have a development computer (pc-dev) and a server where I want to deploy my application (pc-server).
我有一台开发计算机(pc-dev)和一台服务器,我要在其中部署应用程序(pc-server)。 pc-dev is configured with all the development stuff (gcc, Qt5, cmake, etc...) but the pc-server does not have all this tools.
pc-dev配置了所有开发内容(gcc,Qt5,cmake等),但是pc-server没有所有这些工具。 Both runs CentOs 7. My application uses plugins to load some files that extends it's functionality.
两者都运行CentOs7。我的应用程序使用插件来加载一些扩展其功能的文件。
My problem : 我的问题 :
As my console application does not use QtGui / QtWidgets modules, I don't want dependencies on them (Ok that's normal you would say) When I compile my QtPlugin, the generated *.so file have a dependency on Qt5Gui.so (confirmed by ldd myfile.so
), and so when I deploy my application, the loading fails, because Qt5Gui.so is missing. 由于我的控制台应用程序不使用QtGui / QtWidgets模块,因此我不需要它们的依赖关系(好的,您会说这很正常)当我编译我的QtPlugin时,生成的* .so文件具有对Qt5Gui.so的依赖关系(由确认
ldd myfile.so
),因此当我部署应用程序时,加载失败,因为缺少Qt5Gui.so。
I don't understand why I have this dependency because my plugin does not use gui functionnality. 我不明白为什么要使用此依赖项,因为我的插件未使用gui功能。 It just provides methods to get a version / a filename / and some access to it.
它只是提供了获取版本/文件名/以及对其进行某些访问的方法。 The only file included is "QtPlugin".
包括的唯一文件是“ QtPlugin”。
Any ideas ? 有任何想法吗 ?
Thanks 谢谢
I figured out the solution : I had in the *.pro file : 我想出了解决方案:我在* .pro文件中:
QT += core
TARGET = MyPlugin
TEMPLATE = lib
CONFIG += plugin
and it seems that the "gui" module is included by default, so : 并且似乎默认包含“ gui”模块,因此:
QT -= gui
fixed the problem. 解决了问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.