"connection check data mismatch" when loading the plugin for qt5 project

I have a source (without QtDesigner) Qt5 project with two simple plugins that do not load with a laconic error: "plugin validation data mismatch."

The title of the first plugin (which loads and works well):

#ifndef __PIROGRONIAN__P2P2__GUI_PLUGIN__H__ #define __PIROGRONIAN__P2P2__GUI_PLUGIN__H__ #include "QtCore/QtCore" #include "PluginInterface.h" namespace P2P2 { class GuiPlugin : public QObject, public PluginInterface { Q_OBJECT Q_PLUGIN_METADATA(IID "Pirogronian.P2P2.GuiPlugin") Q_INTERFACES(P2P2::PluginInterface) public: bool init(CoreServer *); bool receiveObject(Object*); int channelType(); }; }; #endif 

The second one that does not load:

 #ifndef __PIROGRONIAN__P2P2__CHAT_PLUGIN__H__ #define __PIROGRONIAN__P2P2__CHAT_PLUGIN__H__ #include <QtNetwork/QtNetwork> #include "Chat.h" #include "PluginInterface.h" namespace P2P2 { class ChatPlugin : public QObject, public PluginInterface { Q_OBJECT Q_PLUGIN_METADATA(IID "Pirogronian.P2P2.ChatPlugin") Q_INTERFACES(P2P2::PluginInterface) CoreServer *_server; QHash<Channel *, Chat *> _chats; public: virtual bool init(CoreServer *); virtual bool receiveObject(Object *); virtual int channelType(); }; }; //Q_DECLARE_METATYPE(QPointer<P2P2::ChatPlugin>) #endif 

Here is the PluginInterface header:

 #ifndef __PIROGRONIAN__P2P2__PLUGIN_INTERFACE__H__ #define __PIROGRONIAN__P2P2__PLUGIN_INTERFACE__H__ #include "CoreServer.h" namespace P2P2 { class PluginInterface { public: virtual bool init(CoreServer *) = 0; virtual bool receiveObject(Object *) = 0; virtual int channelType() = 0; }; }; Q_DECLARE_INTERFACE(P2P2::PluginInterface, "Pirogronian/P2P2/PluginInterface/1.0") #endif 

I am not an expert and plugins for qt5 are described very easily. But since I cannot find any significant difference between these plugins, the problem becomes mysterious to me. Mayby error in Qt? I rebuilt both times to make sure both are updated.

I am trying to put all the code on the network, but it will take some time ... Edit: done - packed as zip here: http://uploaduj.net/D74c2f/v0-1-pure-zip/

+6
source share
1 answer

Not sure if this helps, but it seems your plugin has invalid metadata. Here is the code that sets the error message http://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/plugin/qlibrary.cpp#n303

You can use the debug version of Qt and set a breakpoint in this function. This will give you the exact line that does not work when loading your plugin.

Perhaps you have an error in your metadata?

+1
source

Source: https://habr.com/ru/post/986871/


All Articles