QT EGLFS backend with Mesa driver without X11/Xorg - qt

I am trying to run one of the example apps from QT 5.12 without having XServer installed. I am using Ubuntu Linux. When I start it using linuxfb backend, it works fine, but then mapboxgl plugin does not work (probably because of lack of native opengl)
but when I start it with EGLFS backend
./qml_location_mapviewer -platform eglfs
it fails with "Could not initialize egl display"
I tried weston/wayland compositor and -platform wayland everything works as well. Why QT EGLFS does not see my Intel Haswell Open GL device, but everyone else can?

as #derhass suggested it was required to recompile QT with all necessary OpenGL libraries installed first.
# essentials
sudo apt-get install build-essential libssl-dev python
# bluez stack (optional)
sudo apt-get install libbluetooth-dev bluetooth blueman bluez libusb-dev libdbus-1-dev bluez-hcidump bluez-tools
# OpenGL EGL support
sudo apt-get install mesa-utils libegl1-mesa libegl1-mesa-dev libgbm-dev libgbm1 libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
# assuming QT is downloaded and extracted before
cd ~/qt-everywhere-src-5.12.6
./configure -confirm-license -opensource -nomake tests -nomake examples -openssl-linked
Ensure you get EGLFS section similar to this:
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 ............................ yes
EGLFS VSP2 ........................... no
EGLFS Mali ........................... no
EGLFS Raspberry Pi ................... no
EGLFS X11 ............................ yes
LinuxFB ................................ yes
VNC .................................... yes
Mir client ............................. no
Then compile and install the whole thing
make
sudo make install
Compile your project and run it.
cd mapviewer
/usr/local/Qt-5.12.6/qmake
make
./qml_location_mapviewer -platform eglfs

Please have a look here:
https://doc.qt.io/qt-5/embedded-linux.html
In particular, try to set the following environment variable before running your application:
export QT_QPA_EGLFS_INTEGRATION=eglfs_kms
If that doesn't work, do an strace and check for failed open calls to check if any libraries are missing:
strace ./qml_location_mapviewer -platform eglfs 2>&1 | tee log.txt
Of particular importance are the following libraries/plugins in /usr/lib:
libQt5EglFSDeviceIntegration.so.5
libQt5EglFsKmsSupport.so.5
qt5/plugins/platforms/libqeglfs.so
qt5/plugins/egldeviceintegrations/libqeglfs-kms-integration.so

Related

Qml components not loaded properly on xcb platform

I'm trying to run an application on xcb platform over iMx6 (qt 5.12.8), unfortunately some qml objects are not rendered correctly for example components which requires qtgraphicaleffects. I suspect that the reason for this strange behavior is a wrong cross-compilation of qt libraries, in fact no matter I change configure parameters, I'm not able to enable EGL on X11 which should solve my issue.
If I enable qt libs verbose configure I read:
egl-x11.cpp:49:9: error: invalid conversion from ‘EGLNativeDisplayType {aka void*}’ to ‘Display* {aka _XDisplay*}’ [-fpermissive]
dpy = egldpy;
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 ............................ yes
EGLFS Mali ........................... no
EGLFS Raspberry Pi ................... no
EGL on X11 ........................... no
LinuxFB ................................ no
VNC .................................... yes
Mir client ............................. no
Someone faced the same issue? How could be solved? any help would be appreciated.
I'm answering to my own question for whom may face the same problem. I was compiling qt using a sysroot configured to run with Vivante plugin for video acceleration. That was not compatible with eglfs on x11. Without egl , qt libraries are not able to render correctly complex objects such as those mentioned in the question. Compiling with the right dependencies and running with eglfs solved the issue.

Compile QtWebEngine natively on Raspberry Pi

I am trying to compile QtWebEngine on Raspberry Pi 3. Whole Qt library compiled ok, but when I'm trying to run make in the directory with QtWebEngine I get this:
pi#raspberrypi:~/qt5/qtwebengine$ /usr/local/qt5/bin/qmake
Running configuration tests...
Done running configuration tests.
Configure summary:
Qt WebEngine:
Embedded build ......................... yes
Pepper Plugins ......................... no
Printing and PDF ....................... no
Proprietary Codecs ..................... no
Spellchecker ........................... yes
Native Spellchecker .................... no
WebRTC ................................. no
Use System Ninja ....................... no
Geolocation ............................ no
WebChannel support ..................... yes
Use v8 snapshot ........................ yes
Kerberos Authentication ................ no
Building v8 snapshot supported ......... yes
Use ALSA ............................... yes
Use PulseAudio ......................... no
Optional system libraries used:
re2 .................................. no
icu .................................. no
libwebp, libwebpmux and libwebpdemux . no
opus ................................. no
ffmpeg ............................... no
libvpx ............................... no
snappy ............................... no
glib ................................. no
zlib ................................. no
minizip .............................. no
libevent ............................. no
jsoncpp .............................. no
protobuf ............................. no
libxml2 and libxslt .................. no
lcms2 ................................ no
png .................................. no
JPEG ................................. yes
harfbuzz ............................. no
freetype ............................. no
x11 .................................. no
Required system libraries:
fontconfig ........................... no
dbus ................................. no
nss .................................. no
khr .................................. yes
glibc ................................ yes
Required system libraries for qpa-xcb:
libdrm ............................... no
xcomposite ........................... no
xcursor .............................. no
xi ................................... no
xtst ................................. no
WARNING: Thumb instruction set is required to build ffmpeg for QtWebEngine.
Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into '/usr/local/qt5'.
Prior to reconfiguration, make sure you remove any leftovers from
the previous build.
pkg-config is required
QtWebEngine will not be built.
Questions:
Why it cannot be compiled? Because of fontconfig, dbus and nss libraries?
I've tried to install libfontconfig1-dev but it is already installed. The same with dbus and nss.
What I am doing wrong?
You are missing pkg-config and libs are not detected. Note "pkg-config is required". Most likely you compiled qt without pkg-config support.

How to enable EGLFS i.Mx6 QPA for Qt on IMX6Q?

I am cross compiling Qt with Buildroot and GCC Linaro for an IMX6Q target.
I would like to use eglfs platform plugin but i am confused about the list of associated backends available.
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 ............................ yes
EGLFS Mali ........................... no
EGLFS Raspberry Pi ................... no
EGL on X11 ........................... no
LinuxFB ................................ no
VNC .................................... yes
Mir client ............................. no
I guess that the EGLFS i.Mx6 is best suited for IMX6Q but how is it possible to activate this option instead of the EGLDevice or GBM ?
I have configured Qt with -device linux-imx6-g++ ( using buildroot Custom configuration options) but it does not change anything and i don't see any other options so far.
Thanks for any help.
Enable BR2_PACKAGE_IMX_GPU_VIV, which will provide the OpenGL implementation for i.MX6.

Cross Compiling Qt 5.10.1 for Raspberry Pi 3 not compiling webEngine

I'm trying to cross compile the Qt libraries for my raspberry pi. I actually got it working, but the module I needed the most for the project I was planing was not compiled. I need the webengine module.
Here is the output form the configure script:
Qt WebEngine:
Embedded build ......................... yes
Pepper Plugins ......................... no
Printing and PDF ....................... no
Proprietary Codecs ..................... no
Spellchecker ........................... yes
Native Spellchecker .................... no
WebRTC ................................. no
Use System Ninja ....................... no
Geolocation ............................ yes
Use v8 snapshot ........................ yes
Use ALSA ............................... yes
Use PulseAudio ......................... yes
Optional system libraries used:
re2 .................................. no
icu .................................. no
libwebp, libwebpmux and libwebpdemux . yes
opus ................................. yes
ffmpeg ............................... no
libvpx ............................... no
snappy ............................... no
libsrtp .............................. no
glib ................................. yes
zlib ................................. yes
minizip .............................. yes
libevent ............................. yes
jsoncpp .............................. yes
protobuf ............................. no
libxml2 and libxslt .................. yes
lcms2 ................................ no
png .................................. yes
harfbuzz ............................. yes
Required system libraries:
fontconfig ........................... yes
dbus ................................. yes
nss .................................. yes
khr .................................. yes
glibc ................................ yes
Required system libraries for qpa-xcb:
libdrm ............................... yes
xcomposite ........................... no
xcursor .............................. no
xi ................................... no
xrandr ............................... no
xtst ................................. no
As you can see, I have the required system libraries. But do I need everything that is listed under the Qt WebEngine headline?
EDIT: I found out why it was skiping the qtWebEngine:
V8 snapshot cannot be built. Most likely, the 32-bit host compiler does not work. Please make sure you have 32-bit devel environment installed, or configure webengine with '-no-webengine-v8-snapshot'
QtWebEngine will not be built.
I am not sure what the V8 snapshot is used for and why the installer couldn't use the 32-Bit compiler.
This is probably your problem: https://bugreports.qt.io/browse/QTBUG-67983
As you can see, this was fixed in Qt 5.11.1. Unfortunately there is another bug which will prevent you from compiling QtWebengine (workaround included): https://bugreports.qt.io/browse/QTBUG-65256

qt configure issue with cross compilation: device and xplatform

I am trying to cross compile the latest Qt (version 5.9) for the raspberry pi compute module. I am quite new to this but found this guide very helpful: https://visualgdb.com/tutorials/raspberry/qt/embedded/
I followed the instruction but when it comes to configuring qt, I have the following command as suggested in the guide (I have replaced version 5.5 with 5.9):
../qt-everywhere-opensource-src-5.9.0/configure -platform win32-g++ -xplatform linux-arm-gnueabi-g++ -release -opengl es2 -device linux-rasp-pi2-g++ -sysroot C:/SysGCC/Raspberry/arm-linux-gnueabihf/sysroot -prefix /usr/local/qt5
In my case this throws the error that I cannot specify both the xplatform and device parameters. I am new to this and I am not sure which one of the two should be specified!
When you select mkspec for configure you can select a host platform with -platform, or when cross-compiling you can select target platform with -xplatform. When cross-compiling for a specific supported device you select the mkspec with -device. You can give options for the specific device with -device-option flag. When using -device flag you don't use -xplatform flag.
In Qt, there seems to be a device mkspec for Raspberry Pi 2. You can find Qt mkspecs from qtbase module in Qt source tree, e.g. Raspberry Pi 2 mkspec: qt-everywhere-opensource-src-5.9.0/qtbase/mkspecs/devices/linux-rasp-pi2-g++.
There is Raspberry Pi Beginners Guide in Qt wiki which might be helpful. It says you should initially build qtbase and then compile other modules one by one. In the wiki there is an example configure command for Raspberry Pi 2 (in Linux host env) which uses -device and -device-option flags:
./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi
make -j 4
sudo make install

Resources