Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt plugin identifier issue
Qt 6.11 is out! See what's new in the release blog

Qt plugin identifier issue

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 2 Posters 946 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _eph_ Offline
    _eph_ Offline
    _eph
    wrote on last edited by
    #1

    Hi, I've got a Qt plugin which is static for iOS build but dynamic for other systems. This way the IID needs to be different.

    #include <QtQuick>
    #include <QtGlobal>
    
    class myPlugin : public QQmlExtensionPlugin
    {
    	Q_OBJECT
    #if defined(Q_OS_IOS)
        Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
    #else
        Q_PLUGIN_METADATA(IID "myPlugin")
    #endif
    

    The problem is that on iOS it doesn't seem to be using the correct IID. I would get runtime error that myPlugin cannot be found.

    1. I can confirm Q_OS_IOS is defined - when I use #pragma message to see which branch is being used I get the correct one.
    2. When I comment out the conditions and leave just Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0") the app works fine.
    3. When I comment out only Q_PLUGIN_METADATA(IID "myPlugin") the code won't compile with
    Undefined symbols for architecture arm64:
     "qt_static_plugin_myPlugin()", referenced from:
    ...
    

    I'm baffled - it kind of looks like the compiler is using and not using the correct conditional branch at the same time :).

    sierdzioS 1 Reply Last reply
    0
    • _eph_ _eph

      Hi, I've got a Qt plugin which is static for iOS build but dynamic for other systems. This way the IID needs to be different.

      #include <QtQuick>
      #include <QtGlobal>
      
      class myPlugin : public QQmlExtensionPlugin
      {
      	Q_OBJECT
      #if defined(Q_OS_IOS)
          Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
      #else
          Q_PLUGIN_METADATA(IID "myPlugin")
      #endif
      

      The problem is that on iOS it doesn't seem to be using the correct IID. I would get runtime error that myPlugin cannot be found.

      1. I can confirm Q_OS_IOS is defined - when I use #pragma message to see which branch is being used I get the correct one.
      2. When I comment out the conditions and leave just Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0") the app works fine.
      3. When I comment out only Q_PLUGIN_METADATA(IID "myPlugin") the code won't compile with
      Undefined symbols for architecture arm64:
       "qt_static_plugin_myPlugin()", referenced from:
      ...
      

      I'm baffled - it kind of looks like the compiler is using and not using the correct conditional branch at the same time :).

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @_eph said in Qt plugin identifier issue:

      I'm baffled - it kind of looks like the compiler is using and not using the correct conditional branch at the same time :).

      Perhaps the interface is prepared by MOC (Meta Object Compiler) which is known to be quite dumb.

      A few solutions:

      • check the generated moc_*.h file - does it contain correct information?
      • use 2 separate files for your plugin, one for iOS, one for remaining platforms
      • have one plugin "template" (same file you have now, but a single replace line for metadata) then use QMAKE_SUBSTITUTES to dynamically generate proper plugin file during compilation

      (Z(:^

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt
      • Unsolved