Mali GPU accelerated Qt5: Running on Ubuntu 18.04

Ubuntu 18.04 Bionic comes with Qt 5.9.5 by default. However, Canonical has built it without considering the ARM Mali GPU detection, and Qt5 doesn’t work on Ubuntu 18.04 at all. So, we have to build Qt5 from source code manually. This is a quick and dirty build guide, that I tested on the latest ODROID-XU4 Ubuntu 18.04 Bionic OS image.

Installation

$ sudo apt update && sudo apt upgrade && sudo apt dist-upgrade
$ sudo apt build-dep qt5-default
$ apt source qtbase5-dev
$ cd qtbase-opensource-src-5.9.5+dfsg
Next, change line 86 of the file src/platformsupport/eglconvenience/qxlibeglintegration.cpp from:
if (vendor && strstr(vendor, "Vivante")) {
to:
if (vendor && (strstr(vendor, "Vivante") || strstr(vendor, "ARM"))) {
There is a second file should be edited to avoid a compile error. I wasted several hours finding this simple solution at http://code.qt.io/cgit/qt/qtbase.git/commit/?h=dev&id=9a640e7bc67b0a1ff5c61c63703b669e6f24521e. Edit the file src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp and update line 77 from:
-EGLNativeDisplayType QEglFSKmsEglDevice::nativeDisplay() const
to:
void *QEglFSKmsEglDevice::nativeDisplay() const
Additionally, edit the function body from:
return reinterpret_cast(m_devInt->eglDevice());
To:
return m_devInt->eglDevice();
Create two symlinks for proper OpenGL-ES detection. This fix will probably be included in the next update:
$ sudo rm /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0
$ sudo rm /usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0
$ sudo ln -s /usr/lib/arm-linux-gnueabihf/mali-egl/libmali.so /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0
$ sudo ln -s /usr/lib/arm-linux-gnueabihf/mali-egl/libmali.so /usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0
Next, build Qt5:
$ sudo dpkg-buildpackage -b
I met this error when I ran it on a SSH session:
Project ERROR: QtDBus is enabled but session bus is not available. Please check the installation.
When I build Qt from the Mate desktop terminal instead of with remote ssh access, the build had no issue.

After 2~3 hours of build time, the “debian packaging” failed due to a missing PGP key. But all the Qt5 libraries with examples were compiled correctly and I could install them with:

$ sudo make install
Qt-OpenGL example works beautifully now.

Figure 01 - Qt-OpenGl example
Figure 1 – Qt-OpenGl example

We will test the stability and functionality for a couple of weeks. If there are no critical issues, Hardkernel will release it officially. In the meantime, feel free to post your idea on the forum thread at https://forum.odroid.com/viewtopic.php?f=95&t=31070.

Sample Qt4 applications Open Source Computer Vision Library (OpenCV) is an open source computer vision and machine learning software library. Qt5 framework is used with OpenCV for image processing visualization as well as an interactive user interface.

Figure 02 - Face detection with OpenCV
Figure 2 – Face detection with OpenCV

Calligra is a comprehensive set of 8 applications for office, graphics, and management needs, including Word, Presentation, Spreadsheet and much more:

$ sudo apt install calligra-libs
Figure 03 - word program
Figure 3 – word program

Figure 4 - spreadsheet program
Figure 4 – spreadsheet program

Calibre is a powerful and easy to use e-book manager:

$ sudo apt install calibre
Figure 05 - Calibre start screen
Figure 5 – Calibre start screen

Stellarium is a free open source planetarium for your computer. It shows a realistic sky in 3D, just like what you see with the naked eye, binoculars or a telescope:

$ sudo apt install stellarium
Figure 06 - Stellarium
Figure 6 – Stellarium

Krita is a professional and open source painting program. It is made by artists that want to see affordable art tools for everyone. Unfortunately, Krita for the ARM platform in Ubuntu 18.04 PPA was broken, and should be fixed by Canonical soon. It is available in Ubuntu 16.04 PPA only.

Figure 07 - Krita
Figure 7 – Krita

For comments, questions, and suggestions, please visit the original article at http://com.odroid.com/sigong/blog/blog_list.php?bid=199.

Be the first to comment

Leave a Reply