Skip to content

1. How to install a release?

Guillaume Lazar edited this page Mar 21, 2018 · 2 revisions

This is the easier way to use QTRB. You will download and install an existing package (precomplied binaries).

Requirements

  • 64-bit Linux host computer with 10 GB disk space available
  • Raspberry Pi 3
  • 8 GB sdcard

Install a release

  1. Download the qtrb release files from the Release page (e.g: v0.1):
  • qtrb_host_v0.1.zip (22 MB): x64 Qt tools (moc, rcc, qmake, ...) for rpi3
  • qtrb_sysroot_v0.1.zip (1.8 GB): rpi3 OS and cross-compilation sysroot
  • qtrb_device_v0.1.zip (82 MB): Qt headers and ARM libs (libQt5Core.so, ...)
  1. Prepare your host computer:
sudo mkdir /opt/qtrb
sudo chown -R $USER:$USER /opt/qtrb
  1. Unzip the 3 fileson your host (desktop computer) automatically to /opt/qtrb:
unzip qtrb_sysroot_v0.1.zip -d /
unzip qtrb_host_v0.1.zip -d /
unzip qtrb_device_v0.1.zip -d /
  1. Download rpi toolchain (1.2 GB):
git clone --depth=1 -b master https://github.com/raspberrypi/tools /opt/qtrb/toolchain
  1. Copy sysroot to the sdcard. WARNING: check the output file! (e.g: /dev/sdf)
sudo dd bs=4M if=/opt/qtrb/qtrb_v0.1.img of=/dev/sdX conv=fsync status=progress
sudo sync

Then you can eject the sdcard and put it in the Raspberry.

Mount sysroot

SYSROOT=/opt/qtrb/sysroot
SYSROOT_IMG_FILENAME=/opt/qtrb/qtrb_v0.1.img
mkdir -p $SYSROOT
sudo losetup -P /dev/loop0 $SYSROOT_IMG_FILENAME
sudo mount /dev/loop0p2 $SYSROOT

Build your Qt Rpi application from your desktop

  1. Go on your Qt project that you want cross-compile for rpi3, where you must have a Qt .pro project file
cd my-qt-project
  1. Then instead of invoking your desktop qmake, you will use the QTRB qmake for ARM rpi3. This step procude a Makefile ready to cross-compile your application for Rpi3 using the correct toolchain
/opt/qtrb/qt-linux-rasp-pi3/bin/qmake
  1. You can now do a make to build the application
make

You can now start your Raspberry Pi, upload the binary on it and run your application.

Unmount sysroot

Don't forget to unmount the rpi3 sysroot when your build is finished

sudo umount $SYSROOT
sudo losetup -d /dev/loop0