Hello, I just got QGCS to run on a Raspberry Pi3 with the original Raspberry 7" touch display. For those of you that are interested, this is how I made it work.
Requirements:
- Raspberry Pi3
- Host computer running Ubuntu 16.04 64bit
Prepare the RPi3
Install fresh copy of the latest Raspbian OS
Update the RPi3
Edit sources list in /etc/apt/sources.list and uncomment the deb-src line:
sudo nano /etc/apt/sources.list sudo apt-get update sudo apt-get dist-upgrade sudo reboot sudo rpi-update sudo reboot
Make some directories and changing some permissions on the RPi3
sudo mkdir /usr/local/qt5pi sudo chown 1000:1000 /usr/lib/cups/backend/vnc
Install dependencies on the RPi3
sudo apt-get build-dep qt4-x11 sudo apt-get build-dep libqt5gui5 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
You also need to enter the raspi-config tool and do some changes:
sudo raspi-config
Inside the raspi-config tool:
“Advanced Options” → “Memory Split” → 256
and
“Advanced Options” → “GL Driver” → “GL (Fake KMS) OpenGL desktop driver with fake KMS”
Press finish and reboot.
Leave the RPi3 on.
Preparing the host computer
Update
sudo apt-get update sudo apt-get -y upgrade
Install dependencies
sudo apt-get install git bison python gperf
Also download QT Creator and chose QT5.9.3
Generate public SSH key
ssh-keygen -t rsa -C pi@raspberrypi.local -N "" -f ~/.ssh/id_rsa cat ~/.ssh/id_rsa.pub | ssh -o StrictHostKeyChecking=no pi@raspberrypi.local "mkdir -p .ssh && chmod 700 .ssh && cat >> .ssh/authorized_keys"
Create a folder for our project
sudo mkdir /opt/qt5pi sudo chown 1000:1000 /opt/qt5pi cd /opt/qt5pi
Get the toolchain for the RPi
wget https://releases.linaro.org/components/toolchain/binaries/latest-5/arm-linux-gnueabihf/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf.tar.xz tar -xvf gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf.tar.xz
Add toolchain binary directory to PATH. Open .bashrc and add line at end of file
sudo nano ~/.bashrc export PATH=$PATH:/opt/qt5pi/gcc-linaro-5.5.0-2017.10-i686_arm-linux-gnueabihf/bin
To activate this changes, you have to restart the terminal and:
cd /opt/qt5pi
Get the QT sources
wget https://download.qt.io/official_releases/qt/5.9/5.9.3/single/qt-everywhere-opensource-src-5.9.3.tar.xz tar xf qt-everywhere-opensource-src-5.9.3.tar.xz
Get the RPi3 sysrot
mkdir sysroot sysroot/usr sysroot/opt rsync -avz pi@raspberrypi.local:/lib sysroot rsync -avz pi@raspberrypi.local:/usr/include sysroot/usr rsync -avz pi@raspberrypi.local:/usr/lib sysroot/usr rsync -avz pi@raspberrypi.local:/opt/vc sysroot/opt
Convert absolute symlinks into relative symlinks
wget https://raw.githubusercontent.com/riscv/riscv-poky/master/scripts/sysroot-relativelinks.py chmod +x sysroot-relativelinks.py ./sysroot-relativelinks.py sysroot
Make your build folder
mkdir qt5build
Configure your cross-compiled QT
cd qt5build ../qt-everywhere-opensource-src-5.9.3/configure -opengl es2 -device linux-rasp-pi3-vc4-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot /opt/qt5pi/sysroot -prefix /usr/local/qt5pi -opensource -confirm-license -skip qtwebengine -skip qtscript -nomake tests -nomake examples -no-use-gold-linker -make libs -v
This operation should finish without errors before you continue with the next step
Make QT
make make install
Upload QT to the RPi3
cd /opt/qt5pi rsync -avz sysroot/usr/local/qt5pi pi@raspberrypi.local:/usr/local
Qt configuration
Open QtCreator
Tools->Options…->Devices->Add
Generic Linux Device
Edit Hostname, authentication type key, username and add private key ( ~/.ssh/id_rsa )
Tools->Build&Run->Debuggers->Add
Edit name and path ( /opt/qt5pi/gcc-linaro-5.5.0-2017.10-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gdb )
Tools->Compilers->Add->GCC->C
Edit name and path ( /opt/qt5pi/gcc-linaro-5.5.0-2017.10-i686_arm-linux-gnueabihf/binarm-linux-gnueabihf-gcc )
Tools->Compilers->Add->GCC->C++
Edit name and path ( /opt/qt5pi/gcc-linaro-5.5.0-2017.10-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ )
Tools->Qt Versions->Add
Choose /opt/qt5pi/sysroot/usr/local/qt5pi/bin/qmake
Tools->Kits->Add
Edit name to: RaspberryPi
Device type: Generic Linux Device
Device: Choose prior created raspberry pi device
Sysroot: Choose /opt/qt5pi/sysroot
C and C++: Choose prior created raspberry pi compilers
Debugger: Choose prior created raspberry pi debugger
Qt version: Choose prior created raspberry pi qt version
Compile QgroundControl
On the host computer:
git clone --recursive https://github.com/mavlink/qgroundcontrol.git
In Qt Creator: File → Open File or Project → Open qgroundcontrol.pro
Chose the RaspberryPi kit you just created in the previous steps and open the project.
Expand the qgroundcontrol master tree inside Qt Creator and open the file QGCCommon.pri and add edit line 28 to:
} else : linux-rasp-pi3-vc4-g++ {
Now it should be possible to build the project by pressing the “hammer” button on the low left hand side. Be sure that you build with the RaspberryPi kit you created.
When Qgroundcontrol is built you have to transfer the files to the RaspberryPi, you can do this with:
rsync -avz build-qgroundcontrol-RaspberryPi-Release pi@raspberrypi.local:/home/pi
from the host computer.
Launch Qgroundcontrol on the RPi3
Boot the system into Raspbian PIXEL, open a terminal and type:
./build-qgroundcontrol-RaspberryPi-Release/release/qgroundcontrol-start.sh -platform xcb
Happy flying with your new compact GCS solution!
If you have any comment or other ideas please discuss here =)
References:
GitHub - mavlink/qgroundcontrol: Cross-platform ground control station for drones (Android, iOS, Mac OS, Linux, Windows)
https://wiki.qt.io/RaspberryPi2EGLFS
https://www.raspberrypi.org/forums/viewtopic.php?t=204529
https://github.com/AlbrechtL/welle.io/blob/master/RASPBERRY-PI.md