[QBS] Missing metadata URI in static plugin

Dennis Tomas den.t at gmx.de
Mon Jul 25 16:01:51 CEST 2016


Hello,

I am trying to build a static QML plugin and a test application using 
it. So far, I have succeeded in building the plugin and application, but 
when I try to run it (using qbs run), I get the following error message:

file:///home/dt/work/testqtplugin/test/tst_foo.qml:3:1: static plugin 
for module "myplugin" with name "MyPlugin" has no metadata URI
      import myplugin 1.0
      ^
********* Start testing of myplugin *********
Config: Using QtTest library 5.7.0, Qt 5.7.0 (x86_64-little_endian-lp64 
shared (dynamic) release build; by GCC 4.9.1 20140922 (Red Hat 4.9.1-10))
QWARN  : myplugin::tst_foo::compile()
   /home/dt/work/testqtplugin/test/tst_foo.qml produced 1 error(s):
     /home/dt/work/testqtplugin/test/tst_foo.qml:3,1: static plugin for 
module "myplugin" with name "MyPlugin" has no metadata URI
   Working directory: /home/dt/work/testqtplugin
   View: QQuickView, import paths:
     '/home/dt/work/testqtplugin/qt5-debug/install-root/bin'
     'qrc:/qt-project.org/imports'
     '/home/dt/Qt/5.7/gcc_64/qml'
   Plugin paths:
     '.'

With QMake, the solution was adding 'QMAKE_MOC_OPTIONS += 
-Muri=myplugin' to the .pro file. How can I do this in Qbs?

Regards,
Dennis
-------------- next part --------------
import qbs 1.0


QtApplication {

    name: "myplugin-test"

    files: ["test.cpp", "tst_foo.qml"]

    Depends { name: "cpp" }
    Depends { name: "Qt.qmltest" }
    Depends { name: "myplugin" }

    Group {
        fileTagsFilter: "application"
        qbs.install: true
        qbs.installDir: "bin"
    }

    cpp.cxxLanguageVersion: "c++11"
}
-------------- next part --------------
import qbs 1.0

StaticLibrary {
    name: "myplugin"

    Depends { name: "cpp" }
    Depends { name: "Qt.qml" }

    files: ["foo.h", "myplugin.cpp"]

    cpp.defines: ["QT_STATICPLUGIN"]
    cpp.cxxLanguageVersion: "c++11"

    Group {
        files: "myplugin/qmldir"
        qbs.install: true
        qbs.installDir: "bin/myplugin"
    }

    Export {
        Depends { name: "Qt.qml" }
    }
}


More information about the Qbs mailing list