Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt plugin identifier issue
Forum Updated to NodeBB v4.3 + New Features

Qt plugin identifier issue

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 2 Posters 378 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.
  • _ Offline
    _ Offline
    _eph
    wrote on 29 Apr 2019, 21:29 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 :).

    S 1 Reply Last reply 30 Apr 2019, 06:30
    0
    • _ _eph
      29 Apr 2019, 21:29

      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 :).

      S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 30 Apr 2019, 06:30 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

      1/2

      29 Apr 2019, 21:29

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved