QT ON THE RASPBERRY PI 4

출처: https://www.interelectronix.com/qt-raspberry-pi-4.html

QT ON THE RASPBERRY PI 4

Qt is often used to develop graphic interfaces. Qt contains C ++ libraries for creating graphical interfaces that can be compiled on various operating systems.
Since this compilation requires a lot of computing power, it is advisable for processors with relatively little power to carry out the development and compilation on a host computer and only then to load the finished application onto the target computer.
There are lots of instructions online for developing a Qt application for Raspberry Pi 3 and Pi 4 models.

Unfortunately, I couldn’t find one that worked flawlessly for the Raspberry Pi 4 and our needs.

These instructions are heavily based on https://github.com/abhiTronix/raspberry-pi-cross-compilers/blob/master/QT_build_instructions.md and are modified in some places so that it worked for me.

Version 5.15.2 is used for Qt, and I use an Ubuntu 20.0.4 LTS that is installed in vmware as the host computer for cross-compilation.

PREREQUITES

HARDWARE

Host [PC/Laptop]: Any x86/x86_64 AMD/Intel machine
Target [Raspberry Pi 4]: Raspberry Pi 4

SOFTWARE

Host: Any Linux machine (Ubuntu 20.04 LTS Tested)
Target: Raspberry Pi 4 Linux 32-bit OS (Raspbian Bullseye Lite tested)

NOTE

In the background the cross compile toolchains for Raspberry Pi from abhiTronix are used.

OTHERS

Storage and Time Requirements: The build directory takes around ~10GB space and about 2-5 hours to complete (based on dependencies & Host Machine Specifications).
Networking: Your Target Machine (Raspberry Pi) and Host Machine (where you cross-compiling) both MUST have Internet Access, and MUST be on SAME Network to follow these instructions.

 

PREPARING THE RASPBERRY PI 4

For the basic installation, we need a Raspberry Pi OS Lite operating system on the Pi 4. I used “2022-04-04-raspios-bullseye-armhf-lite.img.xz”.

Downloads and instructions on how to create an SD card with this can be found at https://www.raspberrypi.org/downloads/raspbian/.

After switching on the Pi 4, the configuration menu appears, where you can make various settings (e.g., host name, IP address, user, etc.). For our configuration, we need “SSH” activated.

INSTALL AND UPDATE SOFTWARE PACKAGES

  • Add development sources in /etc/apt/sources.list with the following command:

[/crayon]

  • Then update the system with the following commands:

[/crayon]

  • And then install the required Qt and development packages:

[/crayon]

  • Install additional packages (depending on your needs):

[/crayon]

  • Then also create a directory for RaspberryQt:

[/crayon]

SETUP IMPORTANT SYMLINKS

Download symlinker tool and adjust symlinks.

[/crayon]

PREPARING UBUNTU

UPDATE SOFTWARE AND INSTALL ADDITIONAL PACKAGES:

[/crayon]

PREPARE BUILD ENVIRONMENT

  • Create folders:

[/crayon]

  • Download and extract Qt sources:

[/crayon]

  • Patch QT sources.

[/crayon]

  • Download and extract compiler:

[/crayon]

  • rsync files from raspberry: Use your values from your Raspberry for the variables raspberry_ip, raspberry_user and raspberry_pwd.

[/crayon]

[/crayon]

  • Fix symbolic links:

[/crayon]

  • Configure Qt build:

[/crayon]

  • Build Qt:

[/crayon]

  • rsync Qt binaries to Raspberry:

[/crayon]

 

FINAL STEP ON TARGET MACHINE (RASPBERRY PI)

  • Update linker on Raspberry Pi

Enter the following command on the Raspberry Pi to update the device letting the linker to find the new QT binary files:

[/crayon]

INSTALLING QT CREATOR

[/crayon]

CONFIGURE QT CREATOR FOR CROSS COMPILING

Read the blog Configuring Qt-Creator on Ubuntu 20 Lts for cross-compilation for including the compiled binaries (folder  ~/rpi-qt/qt5.15) in Qt Creator.

 

답글 남기기