How to cross-compile QGroundControl for Raspberry Pi3

So, here is short guide how to build QGC on Raspbian Buster with default Qt5 from repos. The exact steps and dependencies may vary, depend on what was already installed on your system:

  • Get the last Rasbian Buster image
  • Update and upgrade it
  • Into raspi-config:
    • “Advanced Options” -> “Memory Split” -> 256
    • “Advanced Options” -> “GL Driver” -> “GL (Fake KMS) OpenGL desktop driver with fake KMS”
  • Install dependencies from this guide:
sudo apt-get install libudev-dev libinput-dev libts-dev libxcb-xinerama0-dev libxcb-xinerama0
sudo apt-get install speech-dispatcher libudev-dev libsdl2-dev libgstreamer1.0-0 gstreamer1.0-plugins-base libgstreamer-plugins-base1.0-dev
  • Install Qt5 dependencies:
sudo apt install qt5-default qtbase5-private-dev qtbase5-dev qtbase5-dev-tools libqt5texttospeech5-dev libqt5svg5-dev qtmultimedia5-dev libqt5serialbus5-dev libqt5charts5-dev libqt5serialport5-dev qtdeclarative5-private-dev qttools5-private-dev qtquickcontrols2-5-dev libssl-dev
  • Install gstreamer plugins if you want videostreaming
  • You need to build QtLocation from sources, because QGC requires location-private and positioning-private which is not available into repos:
git clone https://github.com/qt/qtlocation.git
cd qtlocation
git checkout v5.11.3
mkdir build
cd build/
qmake ../qtlocation.pro
make -j4
sudo make install
  • git clone https://github.com/mavlink/qgroundcontrol.git
  • cd qgroundcontrol && mkdir build && cd build
  • git submodule update --init --recursive
  • I didn’t yet resolve the issue with missing “texttospeech” plugin, so just make an empty directory for successfull building: sudo mkdir /usr/lib/arm-linux-gnueabihf/qt5/plugins/texttospeech
  • Edit your QGCCommon.pri to build everything with right flags (maybe you know the better way, but this one just works):
linux {
    linux-g++ | linux-g++-64 | linux-g++-32 | linux-clang {
#        message("Linux build")
#        CONFIG  += LinuxBuild
#        DEFINES += __STDC_LIMIT_MACROS
#        DEFINES += QGC_GST_TAISYNC_ENABLED
#        DEFINES += QGC_GST_MICROHARD_ENABLED
#        linux-clang {
#            message("Linux clang")
#            QMAKE_CXXFLAGS += -Qunused-arguments -fcolor-diagnostics
#        }
#    } else : linux-rasp-pi3-g++  {
        message("Linux R-Pi2 build")
        CONFIG += LinuxBuild
        DEFINES += __STDC_LIMIT_MACROS __rasp_pi2__
        DEFINES += QGC_GST_TAISYNC_ENABLED
        DEFINES += QGC_GST_MICROHARD_ENABLED
  • qmake -r ../qgroundcontrol.pro CONFIG+=release
  • make -j4
  • When everything will be compiled, cd to ./release directory and run ./qgroundcontrol-start.sh. It will show errors about missing QML plugins - you should apt search for them and install.
  • Enjoy!
2 Likes