Dez 232018

Running Raspbian Stretch on Raspberry Pi 3A/B+

[on RPi] Install a bunch of development files (for simplicity we use build-dep, not everything is really needed, but it is easier this way).

Edit sources list in /etc/apt/sources.list and uncomment the deb-src line:

sudo nano /etc/apt/sources.list

Update your system and install required libraries:

sudo apt-get update
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

Optional depending on your project:

sudo apt-get install wiringpi libnfc-bin libnfc-dev fonts-texgyre

Optional depending if you want to use QtMultimedia:

sudo apt-get install gstreamer1.0-omx libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libopenal-data libsndio6.1 libopenal1 libopenal-dev


[on RPi] Prepare our target directory

sudo mkdir /usr/local/qt5pi
sudo chown pi:pi /usr/local/qt5pi


[on host] Create our working directory and get a toolchain:

mkdir ~/raspi
cd ~/raspi
git clone


[on host] Create a sysroot. Using rsync we can properly keep things synchronized in the future as well.

mkdir sysroot sysroot/usr sysroot/opt
rsync -avz pi@yourpi:/lib sysroot
rsync -avz pi@yourpi:/usr/include sysroot/usr
rsync -avz pi@yourpi:/usr/lib sysroot/usr
rsync -avz pi@yourpi:/opt/vc sysroot/opt


[on host] Adjust symlinks to be relative. Use provided script, because the old fixQualifiedLibraryPaths is not working properly:

chmod +x
./ sysroot


[on host] Get QT (start with qtbase first)

git clone git:// -b 5.11.3
cd qtbase


[on host] Compile, make, make install

./configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v -no-use-gold-linker -no-kms
make -j4
make install

If you failed build –>

git clean -dfx


[on host] Deploy Qt to the device. We simply sync everything from ~/raspi/qt5pi to the prefix we configured above.

rsync -avz qt5pi pi@yourpi:/usr/local


[on RPi] Update the device to let the linker find the Qt libs:

echo /usr/local/qt5pi/lib | sudo tee /etc/
sudo ldconfig


[on host] Build other Qt modules as desired, the steps are always the same:

git clone git://<qt-module>.git -b <qt-version>
cd <qt-module>

~/raspi/qt5/bin/qmake (for QtMultimedia --> ~/raspi/qt5/bin/qmake -r GST_VERSION=1.0)

make install

My Modules:

  • qtbase
  • qtxmlpatterns
  • qtsvg
  • qtdeclarative
  • qtimageformats
  • qtgraphicaleffects
  • qtquickcontrols
  • qtquickcontrols2
  • qtvirtualkeyboard
  • qtwebsockets
  • qtwebglplugin
  • qtcharts
  • qtconnectivity
  • qtmultimedia

Then deploy new files by running:

rsync -avz qt5pi pi@yourpi:/usr/local

Sorry, the comment form is closed at this time.