Skip to content

hgrf/qtxrpi

Repository files navigation

Cross-compilation with Qt5 for Raspberry Pi

Download and setup

sudo make install

# test the emulator with
sudo make run-emulator

For debugging to work, make sure that libpython2.7 is installed. For now, the "Start debugging of startup project" button in QtCreator does not work properly. This is because QtCreator wants to start gdbserver --multi, but inside the Docker we use QEMU user mode emulation, i.e. the GDB server has to be started manually as follows within the emulator:

qemu-aarch64-static -g 10000 <YOUR_EXECUTABLE>

where 10000 is the port where QEMU will set up the GDB server. You can then use Debug->Start Debugging->Attach to Running Debug Server in QtCreator to connect to the application.

Setting up the target Raspberry Pi

echo "$USER ALL=NOPASSWD:$(which rsync)" | sudo tee --append /etc/sudoers
sudo mkdir /usr/local/qt5.15
sudo chown -R pi:pi /usr/local/qt5.15

echo "LC_ALL=en_US.UTF-8" | sudo tee -a /etc/environment
echo "en_US.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen
echo "LANG=en_US.UTF-8" | sudo tee -a /etc/locale.conf
sudo locale-gen en_US.UTF-8

# on host
mkdir ~/rpi-qt
cd ~/rpi-qt

# for debugger {
sudo apt install libncurses5 libpython2.7
# }

On host, execute:

cd ~/rpi-qt
rsync -avz --rsync-path="sudo rsync" qt5.15 pi@192.168.0.14:/usr/local

# update sysroot on host
# TODO: does not need to be rsync, can be local copy or symlink
# rsync -avz --rsync-path="sudo rsync" --delete pi@192.168.0.14:/usr/local sysroot/usr

On Raspberry Pi, execute:

echo /usr/local/qt5.15/lib | sudo tee /etc/ld.so.conf.d/qt5.15.conf
sudo ldconfig

To do

Makefile:

  • sysroot-relativelinks.py is sufficiently small to simply include it in the Makefile

sysroot/build.sh:

  • firmware files should not be required, what about python, perl etc?
  • sort out duplicates between /lib and /usr/lib (are they symlinks on the target?)

References