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

Tico Ballagas ballagas at gmail.com
Fri Oct 1 17:44:48 CEST 2010


In this case, there are actually two layers of libraries.  I have a legacy custom gesture library (libqt_gesture_lib.so that BTW has nothing to do with Qt.labs.gestures), and then I built an extension wrapper (libgestureengine.so) to use that library within QML.  I installed the wrapper (libgestureengine.so), but forgot to install the custom gesture library (libqt_gesture_lib.so) that it dynamically links to.  QMLviewer tries to load the plugin, but the plugin loading is failing under the covers because the plugin can't locate its link dependency (libqt_gesture_lib.so).

Best
-Tico

On Sep 30, 2010, at 9:16 PM, ext aaron.kennedy at nokia.com wrote:

> 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
> 
> 
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml





More information about the Qt-qml mailing list