PDA

View Full Version : Deploying qt5.5 on ubuntu that relies on mediaservice plugins



mkarlsso
9th October 2015, 20:57
I am trying to deploy my application on Ubuntu 14.04 using dynamic linking, but the application appears to have a problem loading one of the plugins (mediaservice/libgstcamerabin.so). The program needs to stream video from a USB webcam and works just fine when I have Qt installed on the machine, but not when it is not. Here is what I have done:

1) Copied over all required libs into the same directory as the application
2) Copied over all required plugins into subfolders in the same directory as the application (including platforms/libqxcb.so and so on)
3) Made a shell script that opens the application and sets the library search path to the current directory (copied from here: http://doc.qt.io/qt-5/linux-deployment.html)
4) In the shell script, I added export QT_DEBUG_PLUGINS=1 to show which plugins are being added.


Then, I run the script, either with Qt installed or without. In both cases the program starts just fine. With qt installed, the program finds the connected USB webcam and starts streaming video. If I remove the Qt directory, the program still starts just fine but can't find the webcam. Looking at the plugin debug outputs I see this:


QFactoryLoader::QFactoryLoader() checking directory path "/home/maxim/trodes/Bin/mediaservice" ...
QFactoryLoader::QFactoryLoader() looking at "/home/maxim/trodes/Bin/mediaservice/libgstaudiodecoder.so"
Found metadata in lib /home/maxim/trodes/Bin/mediaservice/libgstaudiodecoder.so, metadata=
{
"IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0",
"MetaData": {
"Keys": [
"gstreameraudiodecode"
],
"Services": [
"org.qt-project.qt.audiodecode"
]
},
"className": "QGstreamerAudioDecoderServicePlugin",
"debug": false,
"version": 328960
}


Got keys from plugin meta data ("gstreameraudiodecode")
QFactoryLoader::QFactoryLoader() looking at "/home/maxim/trodes/Bin/mediaservice/libgstcamerabin.so"
Found metadata in lib /home/maxim/trodes/Bin/mediaservice/libgstcamerabin.so, metadata=
{
"IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0",
"MetaData": {
"Keys": [
"gstreamercamerabin"
],
"Services": [
"org.qt-project.qt.camera"
]
},
"className": "CameraBinServicePlugin",
"debug": false,
"version": 328960
}


Got keys from plugin meta data ("gstreamercamerabin")
QFactoryLoader::QFactoryLoader() looking at "/home/maxim/trodes/Bin/mediaservice/libgstmediacapture.so"
Found metadata in lib /home/maxim/trodes/Bin/mediaservice/libgstmediacapture.so, metadata=
{
"IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0",
"MetaData": {
"Keys": [
"gstreamermediacapture"
],
"Services": [
"org.qt-project.qt.audiosource"
]
},
"className": "QGstreamerCaptureServicePlugin",
"debug": false,
"version": 328960
}


Got keys from plugin meta data ("gstreamermediacapture")
QFactoryLoader::QFactoryLoader() looking at "/home/maxim/trodes/Bin/mediaservice/libgstmediaplayer.so"
Found metadata in lib /home/maxim/trodes/Bin/mediaservice/libgstmediaplayer.so, metadata=
{
"IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0",
"MetaData": {
"Keys": [
"gstreamermediaplayer"
],
"Services": [
"org.qt-project.qt.mediaplayer"
]
},
"className": "QGstreamerPlayerServicePlugin",
"debug": false,
"version": 328960
}


Got keys from plugin meta data ("gstreamermediaplayer")
loaded library "/home/maxim/trodes/Bin/mediaservice/libgstcamerabin.so"
QLibraryPrivate::loadPlugin failed on "/home/maxim/trodes/Bin/mediaservice/libgstcamerabin.so" : "Cannot load library /home/maxim/trodes/Bin/mediaservice/libgstcamerabin.so: (/home/maxim/trodes/Bin/mediaservice/libgstcamerabin.so: undefined symbol: _ZTI21QGstreamerBufferProbe)"
Webcams: ()



So it looks like it finds the required plugins just fine, but not one if it dependencies? Any advice is appreciated.

anda_skoa
10th October 2015, 11:10
You need to locate the library that has this symbol.

Probably GStreamer Qt bindings.

One thing that you can check additionally is that ldd finds all necessary libs needed by any of the libs you have.
Set the LD_LIBRARY_PATH accordingly and then call ldd on any of the .so files

E.g. ldd mediaservice/libgstcamerabin.so

Cheers,
_

mkarlsso
12th October 2015, 23:31
Thanks for the help. If I do ldd on mediaservice/libgstcamerabin.so, it seems to find all dependencies:


ldd libgstcamerabin.so

linux-vdso.so.1 => (0x00007ffe31d44000)
libqgsttools_p.so.1 => /usr/lib/x86_64-linux-gnu/libqgsttools_p.so.1 (0x00007fcd60d4f000)
libgstaudio-0.10.so.0 => /usr/lib/x86_64-linux-gnu/libgstaudio-0.10.so.0 (0x00007fcd60b17000)
libgstinterfaces-0.10.so.0 => /usr/lib/x86_64-linux-gnu/libgstinterfaces-0.10.so.0 (0x00007fcd60905000)
libgstvideo-0.10.so.0 => /usr/lib/x86_64-linux-gnu/libgstvideo-0.10.so.0 (0x00007fcd606e9000)
libgstpbutils-0.10.so.0 => /usr/lib/x86_64-linux-gnu/libgstpbutils-0.10.so.0 (0x00007fcd604c5000)
libgstapp-0.10.so.0 => /usr/lib/x86_64-linux-gnu/libgstapp-0.10.so.0 (0x00007fcd602b9000)
libgstbase-0.10.so.0 => /usr/lib/x86_64-linux-gnu/libgstbase-0.10.so.0 (0x00007fcd60065000)
libgstreamer-0.10.so.0 => /usr/lib/x86_64-linux-gnu/libgstreamer-0.10.so.0 (0x00007fcd5fd7b000)
libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007fcd5fb2a000)
libgmodule-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007fcd5f926000)
libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007fcd5f724000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fcd5f51c000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fcd5f214000)
libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 (0x00007fcd5eeae000)
libQt5MultimediaWidgets.so.5 => /usr/lib/x86_64-linux-gnu/libQt5MultimediaWidgets.so.5 (0x00007fcd5ec90000)
libQt5Multimedia.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Multimedia.so.5 (0x00007fcd5e9b7000)
libQt5Widgets.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 (0x00007fcd5e18e000)
libQt5Gui.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5 (0x00007fcd5db41000)
libQt5Network.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Network.so.5 (0x00007fcd5d7fd000)
libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007fcd5d157000)
libGL.so.1 => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 (0x00007fcd5cec7000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fcd5cca9000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fcd5c9a5000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fcd5c69f000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fcd5c489000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcd5c0c4000)
libasound.so.2 => /usr/lib/x86_64-linux-gnu/libasound.so.2 (0x00007fcd5bdd4000)
liborc-0.4.so.0 => /usr/lib/x86_64-linux-gnu/liborc-0.4.so.0 (0x00007fcd5bb52000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fcd5b94e000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007fcd5b746000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fcd5b508000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fcd5b2ef000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fcd5b0cd000)
libQt5OpenGL.so.5 => /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5 (0x00007fcd5ae69000)
libpulse.so.0 => /usr/lib/x86_64-linux-gnu/libpulse.so.0 (0x00007fcd5ac1f000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007fcd5a8ea000)
libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007fcd5a6c4000)
libharfbuzz.so.0 => /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007fcd5a46f000)
libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007fcd5a068000)
libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007fcd59cef000)
/lib64/ld-linux-x86-64.so.2 (0x00007fcd611b2000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fcd59ac5000)
libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007fcd5989c000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007fcd5968a000)
libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007fcd59487000)
libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007fcd59281000)
libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007fcd5907f000)
libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007fcd58e68000)
libxcb-dri2.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0 (0x00007fcd58c63000)
libxcb-dri3.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0 (0x00007fcd58a60000)
libxcb-present.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-present.so.0 (0x00007fcd5885d000)
libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007fcd58657000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fcd58438000)
libxshmfence.so.1 => /usr/lib/x86_64-linux-gnu/libxshmfence.so.1 (0x00007fcd58236000)
libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007fcd58030000)
libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007fcd57e24000)
libjson-c.so.2 => /lib/x86_64-linux-gnu/libjson-c.so.2 (0x00007fcd57c19000)
libpulsecommon-5.0.so => /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-5.0.so (0x00007fcd579ab000)
libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007fcd57766000)
libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fcd574c3000)
libgraphite2.so.3 => /usr/lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007fcd572a7000)
libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007fcd55a3a000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007fcd55836000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fcd55630000)
libwrap.so.0 => /lib/x86_64-linux-gnu/libwrap.so.0 (0x00007fcd55426000)
libsndfile.so.1 => /usr/lib/x86_64-linux-gnu/libsndfile.so.1 (0x00007fcd551be000)
libasyncns.so.0 => /usr/lib/x86_64-linux-gnu/libasyncns.so.0 (0x00007fcd54fb8000)
libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007fcd54d9e000)
libFLAC.so.8 => /usr/lib/x86_64-linux-gnu/libFLAC.so.8 (0x00007fcd54b6d000)
libvorbisenc.so.2 => /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2 (0x00007fcd5469e000)
libvorbis.so.0 => /usr/lib/x86_64-linux-gnu/libvorbis.so.0 (0x00007fcd54471000)
libogg.so.0 => /usr/lib/x86_64-linux-gnu/libogg.so.0 (0x00007fcd54268000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007fcd5404d000)

And I used ldd to figure out which libaries and plugins to include in the first place. The really weird thing is that if I put back the Qt directory (from the trash bin), the mediaservice/libgstcamerabin.so located there is used instead and it seems to find what it needs (the webcam is found and it starts streaming video). There is no record in the plugin debug output about what it loads however, which is supposed to happen right? Here is the plugin debug log when qt directory is but back and the camera is found:


Got keys from plugin meta data ("gstreamermediacapture")
QFactoryLoader::QFactoryLoader() looking at "/home/maxim/trodes/Bin/mediaservice/libgstmediaplayer.so"
Found metadata in lib /home/maxim/trodes/Bin/mediaservice/libgstmediaplayer.so, metadata=
{
"IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0",
"MetaData": {
"Keys": [
"gstreamermediaplayer"
],
"Services": [
"org.qt-project.qt.mediaplayer"
]
},
"className": "QGstreamerPlayerServicePlugin",
"debug": false,
"version": 328960
}


Got keys from plugin meta data ("gstreamermediaplayer")
loaded library "/home/maxim/Qt5.5.0/5.5/gcc_64/plugins/mediaservice/libgstcamerabin.so"
Webcams: ("QCameraInfo(deviceName=/dev/video0, position=UnspecifiedPosition, orientation=0)" )
Camera opened

Added after 1 4 minutes:

Update. Found the problem, thanks to your advice. I searched all qt libraries for the missing symbol like this:

find . -name '*.so*' -exec nm --print-file-name --defined-only --dynamic {} \; | grep "_ZTI21QGstreamerBufferProbe"

which returned:


./lib/libqgsttools_p.so.1:0000000000234b10 V _ZTI21QGstreamerBufferProbe
./lib/libqgsttools_p.so.1.0.0:0000000000234b10 V _ZTI21QGstreamerBufferProbe
./lib/libqgsttools_p.so.1.0:0000000000234b10 V _ZTI21QGstreamerBufferProbe
./lib/libqgsttools_p.so:0000000000234b10 V _ZTI21QGstreamerBufferProbe


So I was missing lib/libqgsttools_p.so.1.0.0. and the three symbolic links to the same library. I copied over the library file and made the three symbolic links just like in the qt directory. Works!!

Thanks for your help.