[Qt-qml] QMLviewer silently fails to import plugin when shared library not found

aaron.kennedy at nokia.com aaron.kennedy at nokia.com
Fri Oct 1 06:16:25 CEST 2010


Hi,

On 01/10/2010, at 5:13 AM, ext Tico Ballagas wrote:

> I was having issues debugging an import problem for a custom QDeclarativeExtensionPlugin.
> 
> The ultimate problem was that I forgot to install a required shared library used by my plugin.  However, qmlviewer reported the problem as follows:
> 
> # QML_IMPORT_TRACE=1 qmlviewer gesture.qml 
> QDeclarativeImportDatabase::addImportPath "/usr/lib/qt4/imports" 
> QDeclarativeImportDatabase::addImportPath "/usr/bin" 
> QDeclarativeImportDatabase::addToImport 0x24d37c "." -1.-1 File as ""
> QDeclarativeImportDatabase::add: loaded "/home/user/gestureEngineTest/qmldir" 
> QDeclarativeImportDatabase::importPlugin ".home.user.gestureEngineTest" from "/home/user/gestureEngineTest/lib/libgestureengine.so" 
> QDeclarativeImportDatabase::addToImport 0x24d37c "Qt" 4.7 Library as ""
> file:///home/user/gestureEngineTest/gesture.qml:3:1: GestureEngine is not a type 
>     GestureEngine { 
> 
> where GestureEngine is defined in libgestureengine.so, but it doesn't convey that the plugin import failed.  In fact, the trace leads you believe the plugin was successfully loaded.
> 
> It would be nice if qmlviewer displayed an error like the following:
> error while loading shared libraries: libqt_gesture_lib.so.1: cannot open shared object file: No such file or directory

A brief test on my build indicates that if the plugin fails to load, you do get a descriptive error message:

    file:///Users/aakenned/Qt/qt-qml/test.qml:2:1: module "Qt.labs.gestures" plugin "qmlgesturesplugin" not found 
         import Qt.labs.gestures 1.0 

What I suspect is happening to you is that the plugin is loading successfully, but it doesn't contain a GestureEngine element.  Can you provide more details?

Cheers,

Aaron





More information about the Qt-qml mailing list