Search code examples
c++linuxqt5qtplugin

Deploying Qt console application with QtPlugin


The context :

I'm currently working on a multiplatform server-side console application using Qt. I have a development computer (pc-dev) and a server where I want to deploy my application (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. Both runs CentOs 7. My application uses plugins to load some files that extends it's functionality.

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.

I don't understand why I have this dependency because my plugin does not use gui functionnality. It just provides methods to get a version / a filename / and some access to it. The only file included is "QtPlugin".

Any ideas ?

Thanks


Solution

  • I figured out the solution : I had in the *.pro file :

    QT          += core
    TARGET      = MyPlugin
    TEMPLATE    = lib
    CONFIG      += plugin
    

    and it seems that the "gui" module is included by default, so :

    QT          -= gui
    

    fixed the problem.