Plugin verification data mismatch error on my plugin load



  • Hi,

    When I try to load my plugin it gives me error "Plugin verification data mismatch"

    how can i resolve???


  • Lifetime Qt Champion

    Hi,

    AFAIK, build and use the plugin with the same version of Qt as well as ensure that you have matching debug/release build.

    What version of Qt/OS/Compiler are you using ?



  • sorry SGaist

    this error occurs when it tries to load .a file but when it tries to load .dll
    void MainFrame::loadPlugin() fileName "serverplugind.dll"
    void MainFrame::loadPlugin() pluginLoaded false
    void MainFrame::loadPlugin() pluginLoaded "Unknown error"

    im getting unknown error :(

    Im using Qt 5.3, for both win and android


  • Lifetime Qt Champion

    Do you mean you are trying to load a static plugin ?



  • Sorry to confuse you.

    I am building my project in Release mode. I have already build my plugin code in release mode and my plugin lib name is serverplugin.dll.

    While running I try to load serverplugin.dll,

    @QDir pluginsDir(qApp->applicationDirPath());
    qDebug() << Q_FUNC_INFO << "pluginsDir.dirName"<< pluginsDir.dirName();
    #if defined(Q_OS_WIN)
    if (pluginsDir.dirName().toLower() == "debug" || pluginsDir.dirName().toLower() == "release") {
    pluginsDir.cdUp();
    pluginsDir.cdUp();
    pluginsDir.cd("plugins");
    }
    #endif
    foreach (QString fileName, pluginsDir.entryList(QDir::Files))
    {
    qDebug() << Q_FUNC_INFO << "fileName" << fileName;
    QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName));
    bool pluginLoaded = pluginLoader.isLoaded();
    qDebug() << Q_FUNC_INFO << "pluginLoaded" << pluginLoaded;
    qDebug() << Q_FUNC_INFO << "pluginLoaded" <<
    pluginLoader.errorString();
    QObject *plugin = pluginLoader.instance();
    if (plugin)
    {
    qDebug()<<Q_FUNC_INFO<<"plugin instance is loaded";
    m_pServerInterface = qobject_cast<ServerInterface *>(plugin);
    if (NULL != m_pServerInterface)
    {
    qDebug() << Q_FUNC_INFO << "plugin loaded successfully";
    }
    else
    {
    //error screen should be displayed.
    qDebug() << Q_FUNC_INFO <<
    "plugin object casted to "
    "ServerInterface is Null";
    }
    }
    }@

    I get :

    void MainFrame::loadPlugin() fileName "serverplugin.dll"
    void MainFrame::loadPlugin() pluginLoaded false
    void MainFrame::loadPlugin() pluginLoaded "Unknown error"
    void MainFrame::loadPlugin() plugin instance is loaded
    void MainFrame::loadPlugin() plugin loaded successfully

    ie, My plugin is not loaded successfully but still instance is returned. This happens in windows. But when I build for android it totally fails to get any instance of the plugin


  • Lifetime Qt Champion

    Does your plugin have any dependencies ?



  • yes, it has

    QT += widgets
    QT += network
    QT += sql

    But when I run from the Qt Creator it should be fine right? My plugin .pro file is

    @TEMPLATE = lib
    CONFIG += plugin
    QT += widgets
    QT += network
    QT += sql
    INCLUDEPATH += ../..
    HEADERS = serverplugin.h
    server.h
    serverdbmanager.h
    serverfunctionthread.h
    commondefenitions.h
    SOURCES = serverplugin.cpp
    server.cpp
    serverdbmanager.cpp
    serverfunctionthread.cpp
    TARGET = $$qtLibraryTarget(serverplugin)
    DESTDIR = ../plugins

    OTHER_FILES +=
    serverplugin.json
    @


  • Lifetime Qt Champion

    Did you check that you have all the needed Qt libraries deployed on your target ?



  • I did not get it... It would be helpful if you could explain a bit more... When I run it from Qt Creator do I have to worry about it? I should check it only while creating my executable package.. correct?


  • Lifetime Qt Champion

    If I understood you correctly, it only fails on android, right ?



  • No, when the below lines are executed the cases in windows and android ill explain

    @bool pluginLoaded = pluginLoader.isLoaded();
    QObject *plugin = pluginLoader.instance();
    if (plugin)
    {
    m_pServerInterface = qobject_cast<ServerInterface *>(plugin);
    if (NULL != m_pServerInterface)
    {
    qDebug() << Q_FUNC_INFO << "plugin loaded successfully";
    }
    else
    {
    qDebug() << Q_FUNC_INFO <<
    "plugin object casted to "
    "ServerInterface is Null";
    }
    }@

    win:
    pluginLoaded is false
    *QObject plugin is not null and @qDebug() << Q_FUNC_INFO << "plugin loaded successfully";@ is executed
    so able to call plugin functions

    Android:
    pluginLoaded is false
    *QObject plugin is null
    so not able to call plugin functions


  • Lifetime Qt Champion

    Can you post the plugin header file ?



  • @#ifndef SERVERPLUGIN_H
    #define SERVERPLUGIN_H

    #include <QObject>
    #include <QtPlugin>
    #include "acepos/aceclient/serverinterface.h"

    #include <QThread>
    #include "server.h"

    class ServerPlugin : public QObject,
    public ServerInterface
    {
    Q_OBJECT
    Q_PLUGIN_METADATA(IID "org.qt-project.Qt.AcePos.ServerInterface/1.0" FILE "serverplugin.json")
    Q_INTERFACES(ServerInterface)
    QThread *m_pServerThread;
    Server *m_pServer;
    callbackFunction m_callbackFunction;

    public:
    ServerPlugin():m_pServerThread(NULL), m_pServer(NULL){}

    private slots:
    void handleServiceStartNotify();

    public:
    bool startServerService(callbackFunction);
    bool stopServerService();
    };

    #endif
    @



  • Hi
    Can you tell us how you solved this problem?



  • @LeaA
    I didn't solve it.



  • @Abin

    I solved it..
    check the Q_OBJECT macro and the inheritance from QObject.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.