== 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 {{{ #!/bin/bash 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. 192.168.14.70 192.168.14.5 }}} then just call gcc or make. ==== test that distcc works ==== * cd ~ * mkdir distcc_test * cd distcc_test * nano main.c with the content: {{{ #include 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 }}} === Build QT 5.12 LTS for eglfs === Install and compile Qt 5.12 LTS using this **excellent** guide: [https://www.tal.org/tutorials/building-qt-512-raspberry-pi]. ==== Prerequisites ==== 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. * wget http://download.qt.io/official_releases/qt/5.12/5.12.7/single/qt-everywhere-src-5.12.7.tar.xz * tar xf qt-everywhere-src-5.12.7.tar.xz * git clone https://github.com/oniongarlic/qt-raspberrypi-configuration.git * cd qt-raspberrypi-configuration && make install DESTDIR=../qt-everywhere-src-5.12.7 * apt-get update * apt-get install build-essential libfontconfig1-dev libdbus-1-dev libfreetype6-dev libicu-dev libinput-dev libxkbcommon-dev libsqlite3-dev libssl-dev libpng-dev libjpeg-dev libglib2.0-dev libraspberrypi-dev * mkdir build * cd build 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 * make install This results in the complete build in /opt/Qt5.12 === Building Kirigami === This is based on a combination of the official KDE guide to build the KDE framework at [https://community.kde.org/Get_Involved/development#Set_up_kdesrc-build] and this comprehensive guide at [https://jbbgameich.github.io/misc/2019/05/25/kdesrc-build-custom-qt.html] As above these are the pure commands: * mkdir -p ~/kde/src * cd ~/kde/src/ * git clone https://anongit.kde.org/kdesrc-build.git && cd kdesrc-build * ./kdesrc-build --initial-setup * source ~/.bashrc * nano ~/.kdesrc-buildrc 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 [https://api.kde.org/frameworks/kirigami/html/classorg_1_1kde_1_1kirigami_1_1ApplicationWindow.html] (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 * wget https://www.thinkthinkdo.com/trac/project1/raw-attachment/wiki/mycroft_mark-2_gui_qt5.11/main.qml 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. === build the mycroft GUI === This is following [https://github.com/MycroftAI/mycroft-gui] but building the GUI manually for the QT5.12 and Kirigami installation above * cd ~ * sudo apt-get install git -y * git clone https://github.com/mycroftai/mycroft-gui * 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 {{{ ... find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Quick Core Qml Network WebSockets # WebView ) ... if(NOT CMAKE_SYSTEM_NAME STREQUAL "Android") 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 endif() ... }}} * nano ../application/main.cpp {{{ ... #include #include // #include #ifdef Q_OS_ANDROID ... } // QtWebView::initialize(); QQuickView view; view.setResizeMode(QQuickView::SizeRootObjectToView); ... }}} * export CMAKE_PREFIX_PATH=/opt/Qt5.12:/home/pi/kde/usr * cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DKDE_INSTALL_LIBDIR=lib -DKDE_INSTALL_USE_QT_SYS_PATHS=ON * make -j4 * sudo make install ==== build lottie ==== * rm -rf lottie-qml/ * git clone https://github.com/kbroulik/lottie-qml * cd lottie-qml * mkdir build * cd build * export CMAKE_PREFIX_PATH=/opt/Qt5.12:/home/pi/kde/usr * cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DKDE_INSTALL_LIBDIR=lib -DKDE_INSTALL_USE_QT_SYS_PATHS=ON * 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