Mycroft Mark II - GUI using Qt 5.12 LTS

Building with distcc

The Pi is not the fastest machine and it has limited memory so one can not build for example qtwebengine locally. To use distcc (I have a cluster of 3 gentoo servers for that) I installed a proper toolchain on the hosts using gentoos crossdev with the proper versions for the raspian buster:

  • crossdev --g 8.3.0-r1 --l 2.28-r6 -t arm-linux-gnueabihf

I could not really make distcc work in a "regular" way so I used the good old wrapper method:

  • cd /usr/lib/distcc
  • sudo mkdir bin
  • cd bin
  • sudo nano arm-linux-gnueabihf-wrapper
    exec /usr/lib/distcc/bin/arm-linux-gnueabihf-g${0:$[-2]} "$@"
  • sudo chmod a+x arm-linux-gnueabihf-wrapper
  • sudo ln -s arm-linux-gnueabihf-wrapper c++
  • sudo ln -s arm-linux-gnueabihf-wrapper cc
  • sudo ln -s arm-linux-gnueabihf-wrapper g++
  • sudo ln -s arm-linux-gnueabihf-wrapper gcc
  • sudo ln -s ../../../bin/distcc arm-linux-gnueabihf-g++
  • sudo ln -s ../../../bin/distcc arm-linux-gnueabihf-g++-8
  • sudo ln -s ../../../bin/distcc arm-linux-gnueabihf-gcc
  • sudo ln -s ../../../bin/distcc arm-linux-gnueabihf-gcc-8
  • sudo ls -la

should look like that:

drwxr-xr-x 2 root root 4096 Apr 15 21:03 .
drwxr-xr-x 3 root root 4096 Apr 14 22:05 ..
lrwxrwxrwx 1 root root   19 Apr 14 22:12 arm-linux-gnueabihf-g++ -> ../../../bin/distcc
lrwxrwxrwx 1 root root   19 Apr 14 22:12 arm-linux-gnueabihf-g++-8 -> ../../../bin/distcc
lrwxrwxrwx 1 root root   19 Apr 14 22:12 arm-linux-gnueabihf-gcc -> ../../../bin/distcc
lrwxrwxrwx 1 root root   19 Apr 14 22:12 arm-linux-gnueabihf-gcc-8 -> ../../../bin/distcc
-rwxr-xr-x 1 root root   74 Apr 14 22:09 arm-linux-gnueabihf-wrapper
lrwxrwxrwx 1 root root   27 Apr 14 22:13 c++ -> arm-linux-gnueabihf-wrapper
lrwxrwxrwx 1 root root   27 Apr 14 22:13 cc -> arm-linux-gnueabihf-wrapper
lrwxrwxrwx 1 root root   27 Apr 14 22:13 g++ -> arm-linux-gnueabihf-wrapper
lrwxrwxrwx 1 root root   27 Apr 14 22:13 gcc -> arm-linux-gnueabihf-wrapper

to use distcc to build just set $PATH so that it contains /usr/lib/distcc/bin first:

  • export PATH=/usr/lib/distcc/bin:$PATH

add the build-host to the /etc/distcc/hosts

  • nano /etc/distcc/hosts
    # Add a list of hostnames in one line, seperated by spaces, here.

then just call gcc or make.

test that distcc works

  • cd ~
  • mkdir distcc_test
  • cd distcc_test
  • nano main.c

with the content:

#include <stdio.h>
int main() {
    printf("Hello distcc!\n");
    return 0;

set distcc messages to verbose:

  • export DISTCC_VERBOSE=1

make sure that you have /usr/lib/distcc/bin in the begining of the PATH (see above)

  • gcc -c main.c -o main.o

you should see a lot of messages from distcc (look for something like

distcc[4931] (dcc_r_file_timed) 1032 bytes received in 0.000620s, rate 1626kB/s
distcc[4931] 16823 bytes from main.c compiled on in 0.8614s, rate 19kB/s
distcc[4931] (dcc_unlock) release lock fd4

test that the file is for the correct target (that the translation of gcc to arm-linux-gnueabihf-gcc works)

  • file main.o
    main.o: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), not stripped

link and run:

  • gcc main.o -o main
  • ./main

monitoring distcc

You can monitor the process of distcc with:

  • distccmon-text 1

while the build is running in another terminal, ...

Build QT 5.12 LTS for eglfs

Install and compile Qt 5.12 LTS using this excellent guide:


I did add 1GB swap and set the GPU memory to 16MB while building which worked without problem and took about 10 hours.

Download and build

The following steps are from that guide and is only here so that it does not get lost.

then this command:

PKG_CONFIG_LIBDIR=/usr/lib/arm-linux-gnueabihf/pkgconfig:/usr/share/pkgconfig \
../qt-everywhere-src-5.12.7/configure -platform linux-rpi-g++ \
-v \
-opengl es2 -eglfs \
-no-gtk \
-opensource -confirm-license -release \
-reduce-exports \
-force-pkg-config \
-nomake examples -no-compile-examples \
-skip qtwayland \
-skip qtwebengine \
-no-feature-geoservices_mapboxgl \
-qt-pcre \
-no-pch \
-ssl \
-evdev \
-system-freetype \
-fontconfig \
-glib \
-prefix /opt/Qt5.12 \
-qpa eglfs
  • make -j2
  • sudo make install

This results in the complete build in /opt/Qt5.12

Build QT 5.12 LTS with qtwebengine

If you have distcc working you can build (cross-compile) QT also with qtwebengine using:

PKG_CONFIG_LIBDIR=/usr/lib/arm-linux-gnueabihf/pkgconfig:/usr/share/pkgconfig \
../qt-everywhere-src-5.12.7/configure -platform linux-rpi-g++ \
-v \
-opengl es2 -eglfs \
-no-gtk \
-opensource -confirm-license -release \
-reduce-exports \
-force-pkg-config \
-nomake examples -no-compile-examples \
-skip qtwayland \
-no-feature-geoservices_mapboxgl \
-qt-pcre \
-no-pch \
-ssl \
-evdev \
-system-freetype \
-fontconfig \
-glib \
-prefix /opt/Qt5.12 \
-qpa eglfs

in the process above. When you are using distcc then you can calculate the proper number of jobs like this: (N = total number of cores(local+remote) * 2 + 1, M=number of cores local). for me (3 buildhosts + the Pi) this is N=(4+4+4+4)*2+1=33, M=4 so I run the build with:

  • make -j33 -l4

Building Kirigami

This is based on a combination of the official KDE guide to build the KDE framework at and this comprehensive guide at As above these are the pure commands:

change the qtdir so that it points to the Qt5.12 installation and comment the qt5-build-include and custom-qt5-libs-build-include

#    qtdir  ~/kde/qt5 # Where to find Qt5
    qtdir /opt/Qt5.12
# Qt and some Qt-using middleware libraries
# include /home/pi/kde/src/kdesrc-build/qt5-build-include
# include /home/pi/kde/src/kdesrc-build/custom-qt5-libs-build-include
  • kdesrc-build kirigami --include-dependencies

Test Kirigami

Use the exmaple from (also attached) and try to run it.

  • mkdir -p ~/ws_qt/kirigami
  • cd ~/ws_qt/kirigami

either edit the file and paste the content

  • nano main.qml

or download the attachement

run it (showing additional debug output and adding the kde framwork build to the import path)

  • QT_DEBUG_PLUGINS=1 QML_IMPORT_TRACE=1 QML2_IMPORT_PATH=/home/pi/kde/usr/lib/arm-linux-gnueabihf/qml /opt/Qt5.12/bin/qmlscene ~/ws_qt/kirigami/main.qml

build kio

The mycroft-gui also need KIO from the framework. Build it as above for kirigami.

  • ./kdesrc-build kio

Some of the packages failed to build but they don't seem to be necessary.

building the failed packages =

probably not necessary but, ...


  • export CMAKE_PREFIX_PATH=/opt/Qt5.12:/home/pi/kde/usr
  • apt-get install libpolkit-agent-1-dev libpolkit-gobject-1-dev
  • ./kdesrc-build --no-src polkit-qt-1


  • sudo apt-get install libxslt1-dev
  • ./kdesrc-build --no-src libxslt1-dev


  • sudo apt-get install libxml2-utils docbook-xml docbook-xsl
  • ./kdesrc-build --no-src kdoctools


  • sudo apt-get install texinfo
  • ./kdesrc-build libgpg-error


  • export PKG_CONFIG_PATH=/opt/Qt5.12:$PKG_CONFIG_PATH
  • sudo apt-get install libassuan-dev
  • export CFLAGS="-I/home/pi/kde/usr/include"
  • export LDFLAGS="-L/home/pi/kde/usr/lib"
  • export QT_SELECT=5
  • sudo cp /opt/Qt5.12/bin/moc /usr/lib/qt5/bin/moc
  • ./kdesrc-build --no-src gpgme


  • sudo apt-get install libgcrypt-dev
  • ./kdesrc-build --no-src kwallet

building plasma-nano

Mycroft Mark II - GUI build plasma-nano

build the mycroft GUI

This is following but building the GUI manually for the QT5.12 and Kirigami installation above

  • cd ~
  • sudo apt-get install git -y
  • git clone
  • cd mycroft-gui
  • sudo apt-get install -y git-core g++ cmake extra-cmake-modules gettext pkg-config
  • mkdir build-testing
  • cd build-testing

Thy mycroft-gui has some dependencies (WebView, Plasma) that I removed for now because I don't see where they are used but I will see. Edit the CMakeLists.txt to remove them:

  • nano ../CMakeLists.txt
    #    WebView
        find_package(Qt5Widgets ${QT_MIN_VERSION} REQUIRED)
    #    find_package(KF5Plasma ${KF5_MIN_VERSION} REQUIRED)
        find_package(KF5DBusAddons ${KF5_MIN_VERSION} REQUIRED)
        find_package(KF5KIO ${KF5_MIN_VERSION} REQUIRED) # FIXME look for "KIOWidgets" (KRun) explicitly
  • nano ../application/CMakeLists.txt
    add_executable(mycroft-gui-app ${mycroft_gui_app_SRC})
    #target_link_libraries(mycroft-gui-app Qt5::Core Qt5::Quick Qt5::WebView ${mycroft_gui_app_EXTRA_LIBS})
    target_link_libraries(mycroft-gui-app Qt5::Core Qt5::Quick ${mycroft_gui_app_EXTRA_LIBS})
  • nano ../application/main.cpp
    #include <QDebug>
    #include <QCursor>
    // #include <QtWebView/QtWebView>
    #ifdef Q_OS_ANDROID
    //    QtWebView::initialize();
        QQuickView view;
  • export CMAKE_PREFIX_PATH=/opt/Qt5.12:/home/pi/kde/usr
  • make -j4
  • sudo make install

build lottie

  • rm -rf lottie-qml/
  • git clone
  • cd lottie-qml
  • mkdir build
  • cd build
  • export CMAKE_PREFIX_PATH=/opt/Qt5.12:/home/pi/kde/usr
  • make
  • sudo make install

manually run the mycroft-gui

  • LD_LIBRARY_PATH=/opt/Qt5.12/lib:/home/pi/kde/usr/lib/arm-linux-gnueabihf QT_DEBUG_PLUGINS=1 QML_IMPORT_TRACE=1 QML2_IMPORT_PATH=/home/pi/kde/usr/lib/arm-linux-gnueabihf/qml /usr/bin/mycroft-gui-app
Last modified 2 years ago Last modified on 04/25/20 20:24:00

Attachments (1)

Download all attachments as: .zip