Qt + conan = using null output device, none available - c++

I write my pet project. At first, it was based on cmake and I set the path to qt libs from the console, e.g. cmake -DPATH_TO_QT:STRING=/home/user/Qt/5.11.1/gcc_64/
The variable PATH_TO_QT was declared as set(PATH_TO_QT "/path/to/your/Qt/" CACHE STRING "Path to Qt")
With this configuration, my project worked very well.
However, I wanted to add in my project Conan Package Manager and I did it.
My conanfile.txt:
[requires]
Qt/5.11.1#bincrafters/stable
gtest/1.8.1#bincrafters/stable
libgit2/0.27.7#libgit2pkg/testing
[options]
Qt:qtmultimedia=True
Qt:qtsvg=True
Qt:qttools=True
[generators]
cmake
[imports]
bin, *.pdb -> ./bin
It works. The project builds fine. But in my project, I use QSound:
QSound::play(":/sounds/sounds/open-ended.wav");
In runtime, when the app gives this notification I don't hear it and in the console, I get the next message: using null output device, none available
But in other applications, sound exists.
How to fix this problem?
P.S. Kubuntu 18.04, GCC 7.3, Qt 5.11.1, conan 1.9.1, cmake 3.10.2
P.S2. config.summary
Build type: linux-g++ (x86_64, CPU features: mmx sse sse2)
Configuration: use_gold_linker sse2 aesni sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl compile_examples enable_new_dtags f16c largefile precompile_header rdrnd shani silent x86SimdAlways shared rpath release c++11 c++14 c++1z concurrent dbus no-pkg-config reduce_exports reduce_relocations stl
Build options:
Mode ................................... release
Optimize release build for size ........ no
Building shared libraries .............. yes
Using C++ standard ..................... C++1z
Using ccache ........................... no
Using gold linker ...................... yes
Using new DTAGS ........................ yes
Using precompiled headers .............. yes
Using LTCG ............................. no
Target compiler supports:
SSE .................................. SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
AVX .................................. AVX AVX2
AVX512 ............................... F ER CD PF DQ BW VL IFMA VBMI
Other x86 ............................ AES F16C RDRAND SHA
Intrinsics without -mXXX option ...... yes
Build parts ............................ libs tools
Qt modules and options:
Qt Concurrent .......................... yes
Qt D-Bus ............................... yes
Qt D-Bus directly linked to libdbus .... no
Qt Gui ................................. yes
Qt Network ............................. yes
Qt Sql ................................. yes
Qt Testlib ............................. yes
Qt Widgets ............................. yes
Qt Xml ................................. yes
Support enabled for:
Using pkg-config ....................... no
udev ................................... no
Using system zlib ...................... no
Qt Core:
DoubleConversion ....................... yes
Using system DoubleConversion ........ no
GLib ................................... no
iconv .................................. yes
ICU .................................... no
Tracing backend ........................ <none>
Logging backends:
journald ............................. no
syslog ............................... no
slog2 ................................ no
Using system PCRE2 ..................... no
Qt Network:
getifaddrs() ........................... yes
IPv6 ifname ............................ yes
libproxy ............................... no
Linux AF_NETLINK ....................... yes
OpenSSL ................................ no
Qt directly linked to OpenSSL ........ no
OpenSSL 1.1 ............................ no
SCTP ................................... no
Use system proxies ..................... yes
Qt Gui:
Accessibility .......................... yes
FreeType ............................... yes
Using system FreeType ................ no
HarfBuzz ............................... yes
Using system HarfBuzz ................ no
Fontconfig ............................. no
Image formats:
GIF .................................. yes
ICO .................................. yes
JPEG ................................. yes
Using system libjpeg ............... no
PNG .................................. yes
Using system libpng ................ no
EGL .................................... no
OpenVG ................................. no
OpenGL:
Desktop OpenGL ....................... yes
OpenGL ES 2.0 ........................ no
OpenGL ES 3.0 ........................ no
OpenGL ES 3.1 ........................ no
OpenGL ES 3.2 ........................ no
Vulkan ................................. no
Session Management ..................... yes
Features used by QPA backends:
evdev .................................. yes
libinput ............................... no
INTEGRITY HID .......................... no
mtdev .................................. no
tslib .................................. no
xkbcommon-evdev ........................ no
QPA backends:
DirectFB ............................... no
EGLFS .................................. no
LinuxFB ................................ yes
VNC .................................... yes
Mir client ............................. no
X11:
Using system-provided XCB libraries .. no
EGL on X11 ........................... no
Xinput2 .............................. no
XCB XKB .............................. yes
XLib ................................. yes
XCB render ........................... yes
XCB GLX .............................. yes
XCB Xlib ............................. yes
Using system-provided xkbcommon ...... no
Native painting (experimental) ....... no
Qt Widgets:
GTK+ ................................... no
Styles ................................. Fusion Windows
Qt PrintSupport:
CUPS ................................... no
Qt Sql:
DB2 (IBM) .............................. no
InterBase .............................. no
MySql .................................. no
OCI (Oracle) ........................... no
ODBC ................................... no
PostgreSQL ............................. no
SQLite2 ................................ no
SQLite ................................. yes
Using system provided SQLite ......... no
TDS (Sybase) ........................... no
Qt Testlib:
Tester for item models ................. yes
Qt Multimedia:
ALSA ................................... no
GStreamer 1.0 .......................... no
GStreamer 0.10 ......................... no
Video for Linux ........................ yes
OpenAL ................................. no
PulseAudio ............................. no
Resource Policy (libresourceqt5) ....... no
Windows Audio Services ................. no
DirectShow ............................. no
Windows Media Foundation ............... no
Note: Also available for Linux: linux-clang linux-icc
Note: Disabling X11 Accessibility Bridge: D-Bus or AT-SPI is missing.

I solved the problem myself. So if you have the same problem you can try to install the next dev-libs:
sudo aptitude install libfontconfig1-dev libdbus-1-dev libfreetype6-dev libudev-dev libicu-dev libsqlite3-dev libxslt1-dev libssl-dev libasound2-dev libavcodec-dev libavformat-dev \
libswscale-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev gstreamer-tools gstreamer0.10-plugins-good gstreamer0.10-plugins-bad libraspberrypi-dev libpulse-dev \
libx11-dev libglib2.0-dev libcups2-dev freetds-dev libsqlite0-dev libpq-dev libiodbc2-dev libmysqlclient-dev firebird-dev libpng12-dev libjpeg9-dev libgst-dev libxext-dev libxcb1 \
libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev \
libxcb-sync0 libxcb-sync1-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev libxi-dev libdrm-dev gstreamer0.10-alsa
If you don't want to install gstreamer0.10 you can install gstreamer1.0:
sudo aptitude install gstreamer1.0-omx gstreamer1.0-omx-generic libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer-tools gstreamer1.0-plugins-good gstreamer1.0-plugins-bad

had the same issue and after installing the qt multimedia plugin access to audio devices worked.
E.g: sudo apt install libqt5multimedia5-plugins

Related

No Available Video Device in SDL

The SDL-2 library I'm using was compiled from source.
Whenever I try to run any program that uses SDL-2 on X11, I am given this error:
SDL_Init Error: No available video device
I am running these programs through the command line on Linux Mint 19.3 Tricia.
Here's the ./configure summary:
SDL2 Configure Summary:
Building Shared Libraries
Building Static Libraries
Enabled modules : atomic audio video render events joystick haptic sensor power filesystem threads timers file loadso cpuinfo assembly
Assembly Math : mmx 3dnow sse sse2 sse3
Audio drivers : disk dummy oss
Video drivers : dummy opengl_es2 vulkan
Input drivers : linuxev linuxkd
Using libsamplerate : NO
Using libudev : NO
Using dbus : NO
Using ime : YES
Using ibus : NO
Using fcitx : NO
Looks like your SDL build is missing the X11 backend.
Mint looks sufficiently Debian-y that a sudo apt build-dep libsdl2 ought to pull in the required -dev packages. Then you can re-run ./configure & rebuild/reinstall SDL.
Make sure to double-check that the Video drivers line in the configure summary has the backends you're interested in using.
If the build-dep method is too hand-wavy then docs/README-linux.md has a (kinda old) itemized -dev package list:
================================================================================
Build Dependencies
================================================================================
Ubuntu 13.04, all available features enabled:
sudo apt-get install build-essential mercurial make cmake autoconf automake \
libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \
libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \
libxss-dev libgl1-mesa-dev libesd0-dev libdbus-1-dev libudev-dev \
libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev \
fcitx-libs-dev libsamplerate0-dev libsndio-dev
Ubuntu 16.04+ can also add "libwayland-dev libxkbcommon-dev wayland-protocols"
to that command line for Wayland support.
NOTES:
- This includes all the audio targets except arts, because Ubuntu pulled the
artsc0-dev package, but in theory SDL still supports it.
- libsamplerate0-dev lets SDL optionally link to libresamplerate at runtime
for higher-quality audio resampling. SDL will work without it if the library
is missing, so it's safe to build in support even if the end user doesn't
have this library installed.
- DirectFB isn't included because the configure script (currently) fails to find
it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the
configure script to include DirectFB support. Send patches. :)

Only eglfs when cross-compiling QT static for Raspberry PI

I have cross-compiled QT static for Raspberry PI using
./configure -opengl es2 -opensource -confirm-license -release -static \
-prefix /usr/local/qt5static -hostprefix ~/raspi/qt5 -extprefix ~/raspi/qt5static \
-device linux-rasp-pi-novc-g++ \
-device-option CROSS_COMPILE=arm-raspbian-linux-gnueabihf- \
-optimized-qmake -reduce-exports \
-sysroot ~/raspi/sysroot \
-make libs -make tools -no-use-gold-linker -v
where the 'novc' device is essentially the same as linux-rasp-pi-g++ but with no includes or libs from /opt/vc. When I run the program, it starts in full screen (because of eglfs), and when probed with export QT_DEBUG_PLUGINS=1 yields*
QFactoryLoader::QFactoryLoader() ignoring
"org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3" since
plugins are disabled in static builds qt.qpa.plugin: Could not find
the Qt platform plugin "android" in "" This application failed to
start because no Qt platform plugin could be initialized. Reinstalling
the application may fix this problem.
Available platform plugins are: eglfs, eglfs.
It is fine that the factory loader fails, but why is there only eglfs, and where are there two of them? How can I make sure xcb is an option and that it is the default option?
*I use myapp -platform android since I know that Android is not in there. The dynamically linked QT from sudo apt install qt shows
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl,
offscreen, xcb.
I would like that from my static compile. Here are my QPA backends (I do see eglfs for X11, and maybe that is what I have to trigger...)
QPA backends:
DirectFB ............................... no
EGLFS .................................. yes
EGLFS details:
EGLFS OpenWFD ........................ no
EGLFS i.Mx6 .......................... no
EGLFS i.Mx6 Wayland .................. no
EGLFS RCAR ........................... no
EGLFS EGLDevice ...................... yes
EGLFS GBM ............................ no
EGLFS VSP2 ........................... no
EGLFS Mali ........................... no
EGLFS Raspberry Pi ................... no
EGL on X11 ........................... yes
LinuxFB ................................ yes
VNC .................................... yes
Mir client ............................. no
X11:
Using system-provided XCB libraries .. no
EGL on X11 ........................... yes
Xinput2 .............................. no
XCB XKB .............................. yes
XLib ................................. yes
XCB render ........................... yes
XCB GLX .............................. yes
XCB Xlib ............................. yes
Using system-provided xkbcommon ...... no
Native painting (experimental) ....... no
My hello_plugin_import has this:
// This file is autogenerated by qmake. It imports static plugin classes for
// static plugins specified using QTPLUGIN and QT_PLUGIN_CLASS.<plugin> variables.
#include <QtPlugin>
Q_IMPORT_PLUGIN(QEglFSIntegrationPlugin)
Q_IMPORT_PLUGIN(QXcbEglIntegrationPlugin)
Q_IMPORT_PLUGIN(QXcbGlxIntegrationPlugin)
Q_IMPORT_PLUGIN(QGifPlugin)
Q_IMPORT_PLUGIN(QICNSPlugin)
Q_IMPORT_PLUGIN(QICOPlugin)
Q_IMPORT_PLUGIN(QJpegPlugin)
Q_IMPORT_PLUGIN(QTgaPlugin)
Q_IMPORT_PLUGIN(QTiffPlugin)
Q_IMPORT_PLUGIN(QWbmpPlugin)
Q_IMPORT_PLUGIN(QWebpPlugin)
Q_IMPORT_PLUGIN(QEglFSEmulatorIntegrationPlugin)
Q_IMPORT_PLUGIN(QEglFSKmsEglDeviceIntegrationPlugin)
Q_IMPORT_PLUGIN(QEglFSX11IntegrationPlugin)
Q_IMPORT_PLUGIN(QConnmanEnginePlugin)
Q_IMPORT_PLUGIN(QGenericEnginePlugin)
Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin)
Update. I noticed that I can install a bunch of libxcb packages into my sysroot. I think if I do this, I can get xcb to show up as platform option (or even default platform option??). But does this mess up my static compile? Will my customer also need to have all these libraries installed or will qmake do the right thing?
libglu1-mesa-dev is already the newest version (9.0.0-2.1).
libx11-xcb-dev is already the newest version (2:1.6.4-3).
libxcb-dri2-0-dev is already the newest version (1.12-1).
libxcb-dri2-0-dev set to manually installed.
libxcb-dri3-dev is already the newest version (1.12-1).
libxcb-dri3-dev set to manually installed.
libxcb-glx0-dev is already the newest version (1.12-1).
libxcb-present-dev is already the newest version (1.12-1).
libxcb-present-dev set to manually installed.
libxcb-randr0-dev is already the newest version (1.12-1).
libxcb-randr0-dev set to manually installed.
libxcb-render0-dev is already the newest version (1.12-1).
libxcb-render0-dev set to manually installed.
libxcb-shape0-dev is already the newest version (1.12-1).
libxcb-shape0-dev set to manually installed.
libxcb-sync-dev is already the newest version (1.12-1).
libxcb-sync-dev set to manually installed.
libxcb-xfixes0-dev is already the newest version (1.12-1).
libxcb-xfixes0-dev set to manually installed.
libxcb1-dev is already the newest version (1.12-1).
libxi-dev is already the newest version (2:1.7.9-1).
libxrender-dev is already the newest version (1:0.9.10-1).
The following additional packages will be installed:
libxcb-composite0 libxcb-cursor0 libxcb-damage0 libxcb-dpms0 libxcb-ewmh2 libxcb-record0 libxcb-res0 libxcb-screensaver0 libxcb-xf86dri0 libxcb-xrm0 libxcb-xtest0
libxcb-xv0 libxcb-xvmc0
The following NEW packages will be installed:
libxcb-composite0 libxcb-composite0-dev libxcb-cursor-dev libxcb-cursor0 libxcb-damage0 libxcb-damage0-dev libxcb-dpms0 libxcb-dpms0-dev libxcb-ewmh-dev libxcb-ewmh2
libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-record0 libxcb-record0-dev libxcb-render-util0-dev libxcb-res0 libxcb-res0-dev libxcb-screensaver0
libxcb-screensaver0-dev libxcb-shm0-dev libxcb-util0-dev libxcb-xf86dri0 libxcb-xf86dri0-dev libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xrm-dev libxcb-xrm0 libxcb-xtest0
libxcb-xtest0-dev libxcb-xv0 libxcb-xv0-dev libxcb-xvmc0 libxcb-xvmc0-dev
I believe that when you configure Qt with -static, you are baking the platform plugin into the build and you won't be able to swap between plugins later on. I'm not certain about this, but I've been down that road and wasn't able to get the qpa switching working, there was only ever one platform plugin listed. If there is a way, I'd be very interested to hear about it!
If I'm correct in this, then to use xcb instead of eglfs, you'll need to reconfigure Qt with the first line of your configure something like:
./configure -no-eglfs -qpa xcb -qt-xcb -opensource -confirm-license -release -static \
Good luck

How to compile opencv with gtk 2.x rather than gtk3.x

I'm using tensorflow 1.4 & qt in ubuntu 16.04. The problem is when I include tensorflow(version: 1.4) and opencv (version: 3.2.0) simultaneously, protobuf is conflicted. The error msg is as follows:
[libprotobuf FATAL external/protobuf_archive/src/google/protobuf/stubs/common.cc:79] This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.4.0). Contact the program author for an update. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "/build/mir-O8_xaj/mir-0.26.3+16.04.20170605/obj-x86_64-linux-gnu/src/protobuf/mir_protobuf.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.4.0). Contact the program author for an update. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "/build/mir-O8_xaj/mir-0.26.3+16.04.20170605/obj-x86_64-linux-gnu/src/protobuf/mir_protobuf.pb.cc".)
I learnt from some place that opencv with gtk-3.x will use protobuf 2.6.1 which caused the above problem, and installing opencv with gtk-2.x will not depend on protobuf. And part of the opencv cmake msg is as follows, cmake use gtk 3.x automaticly.
GUI:
-- QT: NO
-- GTK+ 3.x: YES (ver 3.18.9)
-- GThread : YES (ver 2.48.2)
-- GtkGlExt: NO
-- OpenGL support: NO
-- VTK support: NO
And the system gtk information is as follows:
$ pkg-config --modversion gtk+-2.0
$ 2.24.30
Here is the problem.How I can install opencv with gtk 2.x using cmake?
For me you just need to install the required dependency, which is a version of protobuf compatible with 2.6.1.
A quick search on packages.ubuntu.com shows that the package libprotobuf9v5 provides protocol buffers C++ library and is in version 2.6.1. Just try to install this.
BTW, going back in the past using outdated technologies like GTK+2 is a bad move. If you really want to change your toolkit, selecting it is just a matter of defining the right options on the cmake call. In the toplevel CMakeLists.txt one can easily find WITH_GTK, WITH_GTK2, and WITH_QT options. Enable them on the command line call to cmake, or using cmake-gui And if you're already using Qt yourself, just rebuild using the Qt backend instead of an old GTK one.

Qt5WebKit module library is not built, when most others are built

I am building the Qt opensource on Ubuntu Linux. The target platform is the BeagleBone Black. Build process itself runs successfully, but I do not find the libQt5Webkit.so in the /lib/ directory.
Build and target platform details:
Host: Ubuntu Linux 15.04 x64
Target Hardware: BeagleBone Black
Target OS: Angstrom Linux
Toolchain: arm-linux-gnueabi
Qt Version: 5.4.2
Build Command: ./configure -v -opensource -confirm-license -prefix
/home/developer/projects/dependencies/qt/qt-5.4.2_Angstrom_BBB
-device linux-beagleboard_angstrom-g++
I am not disabling any modules as evident from the ./configure command options.
I have the following questions:
Is the building of the QtWebKit module disabled / removed?
How do I enable building the QtWebKit module project?
How can I cross-compile only the QtWebKit project?
If more information is required, I will provide.
Thanks.

OpenCV 2.4.7 with FFMpeg support build with VS 2010 (x86)

I'm fighting with new version of OpenCV 2.4.7 for almost one week (prev. used 2.4.2). My motivation for the new setup is the fact that I run into problems using the Videowriter for uncompressed grayscale videos (http://answers.opencv.org/question/3603/videowriter-videocapture-and-uncompressed-avi/). In https://github.com/Itseez/opencv/pull/1516 "akarsakov" is recommending to build OpenCV without vfw support and open uncompressed video through ffmpeg. That's what I tried to do. I followed basically the instructions mentioned in this video: http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html
I had successfully build opencv with Qt 5.1.1 (http://answers.opencv.org/question/24184/how-to-compile-opencv-247-with-qt-and-ffmpeg/). But I'm not able to get the VideoWriter & VideoCapture work for me. So what I did:
I downloaded the newest ffmpeg build from http://ffmpeg.zeranoe.com/builds/
I generated the vs2010 project disabling VfW and enabling ffmpeg instead:
Video I/O:
Video for Windows: NO
DC1394 1.x: NO
DC1394 2.x: NO
FFMPEG: YES (prebuilt binaries)
codec: YES (ver 55.18.102)
format: YES (ver 55.12.100)
util: YES (ver 52.38.100)
swscale: YES (ver 2.3.100)
gentoo-style: YES
OpenNI: NO
OpenNI PrimeSensor Modules: NO
PvAPI: NO
GigEVisionSDK: NO
DirectShow: YES
Media Foundation: NO
XIMEA: NO
I added the include directories and libs for ffmpeg to the highgui module.
I was not able to compile OpenCV without any errors but the behaviour what I see is not what I expect:
Build OpenCV 2.4.7 without VfW -> VideoWriter.open () returns always false!
Build OpenCV 2.4.7 with VfW -> VideoWriter.open () returns true for the time, calling a release() and an open() on the same object returns always a false.
With or without ffmpeg -> An VideoCapture.open () gives a error message asking for libiconv-2dll!
Does some had the same problems and is able to point me to my mistake?
Thank you in advance.
cheers
OpenCV 2.4.7 requires a more recent version of FFmpeg to work, but that doesn't seem to the issue since you have that covered.
The cause of your problem could be bug #2281: VideoCapture::read fails on uncompressed video.
As an intermediary solution, I suggest you to downgrade to OpenCV 2.4.5.