Raspberry Pi Qt cross-compile: Unterschied zwischen den Versionen
Nick (Diskussion | Beiträge) |
Nick (Diskussion | Beiträge) |
||
| (60 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 13: | Zeile 13: | ||
:2. SSH und USB aktivieren: [https://wiki.xnick.de/index.php/Raspberry_Pi_CM4 Raspberry Pi CM4] | :2. SSH und USB aktivieren: [https://wiki.xnick.de/index.php/Raspberry_Pi_CM4 Raspberry Pi CM4] | ||
:3. Image auf CM4 kopieren: [https://wiki.xnick.de/index.php/Raspberry_Pi_CM4 Raspberry Pi CM4] | :3. Image auf CM4 kopieren: [https://wiki.xnick.de/index.php/Raspberry_Pi_CM4 Raspberry Pi CM4] | ||
<br> | |||
Kopieren des Image auf einem RPI mit SD-Karte: | Kopieren des Image auf einem RPI mit SD-Karte: | ||
dd if=raspbian.img of=/dev/sdb bs=1M #raspbian.img ⇒ SD-Card | dd if=raspbian.img of=/dev/sdb bs=1M #raspbian.img ⇒ SD-Card | ||
| Zeile 123: | Zeile 123: | ||
VNC .................................... yes | VNC .................................... yes | ||
Wenn alles korrekt: | Wenn alles korrekt: | ||
make | make -j2 #Anzahl verwendeter Kerne, hier 2 Kerne | ||
make install | make install | ||
| Zeile 132: | Zeile 132: | ||
|- | |- | ||
|<code>-release</code> | |<code>-release</code> | ||
| | |Debugging aus schalten | ||
|- | |- | ||
|<code>-opengl es2</code> | |<code>-opengl es2</code> | ||
| Zeile 141: | Zeile 141: | ||
RPI1:<code>linux-rasp-pi-g++</code><br> | RPI1:<code>linux-rasp-pi-g++</code><br> | ||
RPI2:<code>linux-rasp-pi2-g++</code><br> | RPI2:<code>linux-rasp-pi2-g++</code><br> | ||
RPI3:<code> | RPI3:<code>linux-rasp-pi3-g++</code><br> | ||
RPI4:<code>linux-rasp-pi4-v3d-g++</code><br> | RPI4:<code>linux-rasp-pi4-v3d-g++</code><br> | ||
Optionen für | Optionen für bestimmtes Ziel-Gerät hier RPI4; Liste unterstützter Geräte qtbase/mkspecs/devices | ||
|- | |- | ||
|<code>-device-option CROSS_COMPILE=/opt/qt5.15.2/tools/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-</code> | |<code>-device-option CROSS_COMPILE=/opt/qt5.15.2/tools/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-</code> | ||
| Zeile 155: | Zeile 155: | ||
|- | |- | ||
|<code>-opensource</code> | |<code>-opensource</code> | ||
| | |Die Lizenz wird auf GPL/LGPL gesetzt | ||
|- | |- | ||
|<code>-confirm-license</code> | |<code>-confirm-license</code> | ||
| | |Lizenzbedingungen zustimmen | ||
|- | |- | ||
|<code>-skip qtscript -skip qtwayland -skip qtwebengine</code> | |<code>-skip qtscript -skip qtwayland -skip qtwebengine</code> | ||
| | |Überspringen von Modulen (qtscript, qtwayland, qtwebengine) | ||
|- | |- | ||
|<code>-nomake tests</code> | |<code>-nomake tests</code> | ||
| | |Bauen von Tests aussschließen | ||
|- | |- | ||
|<code>-make libs</code> | |<code>-make libs</code> | ||
| | |Bauen von libs hinzufügen | ||
|- | |- | ||
|<code>-pkg-config</code> | |<code>-pkg-config</code> | ||
| | |Um Abhängigkeiten beim Cross-Compiling aufzulösen, erfordert PKG_CONFIG_PATH, PKG_CONFIG_PREFIX | ||
|- | |- | ||
|<code>-no-use-gold-linker</code> | |<code>-no-use-gold-linker</code> | ||
| | |GNU Gold Linker wird nicht verwendet | ||
|- | |- | ||
|<code>-v</code> | |<code>-v</code> | ||
| | |Ausführliche Informationen über jeden Schritt des configure-Prozesses ausgeben | ||
|- | |- | ||
|<code>-recheck</code> | |<code>-recheck</code> | ||
| | |Bei einer neuen configuration wird das Build-Verzeichnis aktualisiert | ||
|} | |} | ||
| Zeile 192: | Zeile 192: | ||
==Update RPI== | ==Update RPI== | ||
RPI Bibliotheken updaten: | RPI Bibliotheken updaten: | ||
echo /usr/local/ | echo /usr/local/qt5.15/lib | sudo tee /etc/ld.so.conf.d/qt5.15.conf | ||
sudo ldconfig | sudo ldconfig | ||
== | ==QT Creator== | ||
QT 5.15.2 installieren. Sollte Qt Creator nicht starten:<br> | |||
<code>/install_pfad/Qt/Tools/QtCreator/bin/qtcreator</code> | |||
{| class="wikitable" | |||
|+ | |||
!Fehler | |||
!Lösung | |||
|- | |||
|qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. | |||
|<code>export QT_DEBUG_PLUGINS=1</code> | |||
|- | |||
|Cannot load library /home/user/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so | |||
|<code>sudo apt install --reinstall libxcb-xinerama0</code> | |||
|} | |||
Qt Creater starten und unter <code>Werkzeuge ⇒ Einstellung... ⇒ Kits</code> nachfolgende Parameter einstellen. | |||
== | ===Qt Versionen=== | ||
Einstellungen ⇒ Kits ⇒ Qt Versionen ⇒ Hinzufügen | |||
qmake location: /opt/qt5.15.2/qt5.15/bin/qmake | |||
Einstellungen ⇒ | |||
===Compiler=== | ===Compiler=== | ||
Einstellungen ⇒ Kits ⇒ Compilers ⇒ Hinzufügen ⇒ GCC ⇒ C und C++ | Einstellungen ⇒ Kits ⇒ Compilers ⇒ Hinzufügen ⇒ GCC ⇒ C und C++ | ||
Compiler path C: | Compiler path C: /opt/qt5.15.2/tools/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc | ||
Compiler path C++: | Compiler path C++: /opt/qt5.15.2/tools/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ | ||
===Debugger=== | ===Debugger=== | ||
Einstellungen ⇒ Debuggers ⇒ Hinzufügen | Einstellungen ⇒ Debuggers ⇒ Hinzufügen | ||
/opt/qt5.15.2/tools | /opt/qt5.15.2/tools/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gdb | ||
=== | ===Geräte=== | ||
Einstellungen | Einstellungen ⇒ Geräte ⇒ Hinzufügen ⇒ Geberic Linux Device ⇒ IP, user, pass ⇒ Finish<br> | ||
RPI root per SSH erlauben: | |||
sudo vim /etc/ssh/sshd_config | |||
PermitRootLogin yes #Auskommentieren und auf yes ändern | |||
sudo reboot | |||
===Kits=== | ===Kits=== | ||
Einstellungen ⇒ Build & Run ⇒ Kits ⇒ Hinzufügen | Einstellungen ⇒ Build & Run ⇒ Kits ⇒ Hinzufügen | ||
Generic Linux Device | Device type: Generic Linux Device | ||
Device: | Device: Welches zuvor erstellt wurde | ||
Sysroot: | Sysroot: /opt/qt5.15.2/sysroot | ||
Compiler: | Compiler: Welches zuvor erstellt wurde | ||
Debugger: | Debugger: Welches zuvor erstellt wurde | ||
Qt version: | Qt version: Welches zuvor erstellt wurde | ||
Qt mkspec: | Qt mkspec: bleibt leer | ||
==GammaRay== | |||
sudo apt install gammaray | |||
==bcm2835== | ==bcm2835== | ||
Sollten die bcm2835 Dateien angepasst werden sind die Schritte '''"Veränderung der <code>.h</code> und <code>.c</code> Datein:"''' und '''"Einbinden in Qt Creator"''' erneut durchzuführen. | |||
===Download=== | ===Download=== | ||
Auf RPI | Auf RPI herunterladen [https://www.airspayce.com/mikem/bcm2835/ bcm2835] | ||
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.69.tar.gz | wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.69.tar.gz | ||
tar zxvf bcm2835-1.69.tar.gz | |||
cd bcm2835-1.69 | |||
oder die angepasste Version vom Gitlab-Server [https://gitlab.hzdr.de/FWF/Libraries/rpi/bcm2835-custom bcm2835-custom] | |||
git clone https://gitlab.hzdr.de/FWF/Libraries/rpi/bcm2835-custom.git | |||
cd bcm2835-custom | |||
===Installation=== | ===Installation=== | ||
./configure | ./configure | ||
make | make | ||
sudo make check | sudo make check | ||
sudo make install | sudo make install | ||
Veränderung der <code>.h</code> und <code>.c</code> Datein: | |||
make clean | make clean | ||
./configure | ./configure | ||
| Zeile 253: | Zeile 268: | ||
sudo make check | sudo make check | ||
sudo make install | sudo make install | ||
===Einbinden in Qt Creator=== | |||
Weiter auf dem RPI: | |||
sudo cp /usr/local/lib/libbcm2835.a /usr/lib/ | |||
sudo cp /usr/local/include/bcm2835.h /usr/include | |||
Danach das sysroot auf dem Host wieder syncronisieren: | |||
rsync -avz pi@cm4:/lib sysroot | |||
rsync -avz pi@cm4:/usr/include sysroot/usr | |||
rsync -avz pi@cm4:/usr/lib sysroot/usr | |||
rsync -avz pi@cm4:/opt/vc sysroot/opt | |||
Nach einem rsync vom RPI zum Host ist ein erneutes anpassen der symlinks notwendig: | |||
cd /opt/qt5.15.2 | |||
./sysroot-relativelinks.py sysroot | |||
Im Qt Creator die <code>.pro</code> anpassen | |||
LIBS += -L"/usr/lib" -lbcm2835 | |||
Und dann die Header-Datei wie gewünscht einbinden: | |||
#include <bcm2835.h> | |||
== Probleme == | |||
{| class="wikitable" | |||
|+ | |||
!Fehler | |||
!Lösung | |||
|- | |||
|[HOST] Qt Creator bricht mit folgender Fehlermeldung ab: | |||
<code>qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.</code> | |||
|<code>export QT_DEBUG_PLUGINS=1</code> | |||
|- | |||
|[HOST] Qt Creator bricht mit folgender Fehlermeldung ab: | |||
<code>Cannot load library /home/user/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so</code> | |||
|<code>sudo apt install --reinstall libxcb-xinerama0</code> | |||
|- | |||
|[RPI] Qt App bricht auf RPI (DSI-Display) mit folgender Fehlermeldung ab: | |||
<code>drmModeGetResources failed (Operation not supported) | |||
no screens available, assuming 24-bit color</code> | |||
|<code>sudo vim /boot/config.txt | |||
dtoverlay=vc4-fkms-v3d</code> | |||
|} | |||
==Quellen== | ==Quellen== | ||
| Zeile 259: | Zeile 313: | ||
[https://wapel.de/?p=842 Cross-Compile QT 5.15.2 / Raspberry Pi 4]<br> | [https://wapel.de/?p=842 Cross-Compile QT 5.15.2 / Raspberry Pi 4]<br> | ||
[https://www.interelectronix.com/de/qt-515-cross-compile-fuer-raspberry-compute-module-4-auf-ubuntu-20-lts.html Qt 5.15 cross compile RPI4 auf Ubuntu 20 LTS]<br> | [https://www.interelectronix.com/de/qt-515-cross-compile-fuer-raspberry-compute-module-4-auf-ubuntu-20-lts.html Qt 5.15 cross compile RPI4 auf Ubuntu 20 LTS]<br> | ||
[https://doc.qt.io/archives/qtextended4.4/buildsystem/over-configure-options-1.html qt cross-compile configure-options] | |||
Aktuelle Version vom 1. Juli 2021, 08:32 Uhr
Raspberry Pi Qt cross-compile
Anleitung Cross-Compiling von Qt auf dem Raspberry PI 4 (RPI4) und ComputeModul 4 (CM4).
Eigenheiten beim RPI4 oder CM4 sind gekennzeichnet mit [RPI4] oder [CM4].
Vorbereitung RPI
Download letztes raspian-lite:
wget https://downloads.raspberrypi.org/raspios_lite_armhf_latest wget https://downloads.raspberrypi.org/raspios_lite_armhf_latest -O "raspios.zip" unzip raspios.zip
[CM4] Um mit dem CM4 arbeiten zu können muss USB und/oder SSH aktiviert werden. Für das kopieren von raspbian.img auf den eMMC wird das Tool rpiboot benötigt.
- 1. Image mounten: Linux - ISO-Image bearbeiten
- 2. SSH und USB aktivieren: Raspberry Pi CM4
- 3. Image auf CM4 kopieren: Raspberry Pi CM4
Kopieren des Image auf einem RPI mit SD-Karte:
dd if=raspbian.img of=/dev/sdb bs=1M #raspbian.img ⇒ SD-Card dd if=/dev/sdb of=raspbian.img bs=1M #SD-Card ⇒ raspbian.img sync #leeren Zwischenspeicher BS
RPI starten, Dateisystem erweitern und Grafikspeicher erhöhen:
sudo raspi-config # 1 System Options ⇒ S4 Hostname ⇒ cm4
# 4 Performance Options ⇒ GPU Memory ⇒ 128
# 6 Advanced Options ⇒ A1 Expand Filesystem
sudo reboot
sudo apt update && sudo apt upgrade -y
sudo apt autoremove # Wenn nötig
Installation Bibliotheken:
sudo vim /etc/apt/sources.list #uncomment the deb-src line sudo apt update sudo apt build-dep qt5-qmake -y sudo apt build-dep libqt5gui5 -y sudo apt build-dep libqt5webengine-data -y sudo apt build-dep libqt5webkit5 -y sudo apt install libudev-dev libinput-dev libts-dev libxcb-xinerama0-dev libxcb-xinerama0 gdbserver -y
Zielverzeichnis anlegen:
sudo mkdir /usr/local/qt5.15 sudo chown pi:pi /usr/local/qt5.15
Zugriff RPI Datein
Variante 1: Netzwerk
Der RPI muss per ssh erreichbar sein.
Variante 2: mount image
Image von SD-Karte ziehen:
sudo mkdir /mnt/rasp-pi-rootfs dd if=/dev/sdb of=raspbian.img bs=1M fdisk -l raspian.img sudo mount -o loop,offset=62914560 raspian.img /mnt/rasp-pi-rootfs #Partition 2: 512 * 122880 = 62914560
Variante 3: mount SD-Card
Das mounten der SD-Karte erfolgt in den meisten Linux-Distributionen automatisch. Ansonsten:
sudo mount /dev/sdb2 /mnt/rasp-pi-rootfs
Vorbereitung HOST
Installation eines Ubuntu 20.04 (64Bit) (Minimal Installation) in einer VirtualBox.
Nach der BS installation Updates installiern:
sudo apt update && sudo apt upgrade -y sudo apt install build-essential -y
Cross-Compile Toolchain
Arbeitsverzeichnis und Tools
Arbeitsverzeichnis anlegen und nötige Tools installieren:
sudo mkdir /opt/qt5.15.2 /opt/qt5.15.2/build /opt/qt5.15.2/tools sudo chown -R user:user /opt cd /opt/qt5.15.2
sysroot
Erstellen des sysroot Verzeichniss-Struktur und synchronisation mit raspian-image sysroot verzeichniss.
mkdir sysroot sysroot/usr sysroot/opt
Mit gemounterter SD-Karte:
rsync -avz /mnt/rasp-pi-rootfs/lib sysroot rsync -avz /mnt/rasp-pi-rootfs/usr/include sysroot/usr rsync -avz /mnt/rasp-pi-rootfs/usr/lib sysroot/usr rsync -avz /mnt/rasp-pi-rootfs/opt/vc sysroot/opt
Oder übers Netzwerk:
rsync -avz pi@cm4:/lib sysroot rsync -avz pi@cm4:/usr/include sysroot/usr rsync -avz pi@cm4:/usr/lib sysroot/usr rsync -avz pi@cm4:/opt/vc sysroot/opt
Symlinks
Symlinks relativ anpassen:
wget https://raw.githubusercontent.com/Kukkimonsuta/rpi-buildqt/master/scripts/utils/sysroot-relativelinks.py chmod +x sysroot-relativelinks.py ./sysroot-relativelinks.py sysroot #Bei Problemen: sudo ln -s /usr/bin/python3 /usr/bin/python
Qt Resourcen
Download Qt Resourcen [Pfad: /opt/qt5.15.2]
sudo wget http://download.qt.io/archive/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz sudo tar -vxf qt-everywhere-src-5.15.2.tar.xz
mkspec Datei für den Compiler modifizieren
cp -R qt-everywhere-src-5.15.2/qtbase/mkspecs/linux-arm-gnueabi-g++ qt-everywhere-src-5.15.2/qtbase/mkspecs/linux-arm-gnueabihf-g++ sed -i -e 's/arm-linux-gnueabi-/arm-linux-gnueabihf-/g' qt-everywhere-src-5.15.2/qtbase/mkspecs/linux-arm-gnueabihf-g++/qmake.conf
Cross-Compiler
Download Linaro v7.4.1:
cd /opt/qt5.15.2/tools wget https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabihf/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.xz tar -vxf gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.xz
Qt für RPI kompilieren:
cd /opt/qt5.15.2/build ../qt-everywhere-src-5.15.2/configure -release -opengl es2 -device linux-rasp-pi4-v3d-g++ -device-option CROSS_COMPILE=/opt/qt5.15.2/tools/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /opt/qt5.15.2/sysroot -prefix /usr/local/qt5.15 -extprefix /opt/qt5.15.2/qt5.15 -opensource -confirm-license -skip qtscript -skip qtwayland -skip qtwebengine -nomake tests -make libs -pkg-config -no-use-gold-linker -v -recheck
EGLFS-Bedingungen:
QPA backends:
DirectFB ............................... no
EGLFS .................................. yes [Sollte YES sein]
EGLFS details:
EGLFS OpenWFD ........................ no
EGLFS i.Mx6 .......................... no
EGLFS i.Mx6 Wayland .................. no
EGLFS RCAR ........................... no
EGLFS EGLDevice ...................... yes [Sollte YES sein]
EGLFS GBM ............................ yes
EGLFS VSP2 ........................... no
EGLFS Mali ........................... no
EGLFS Raspberry Pi ................... no [Sollte NO sein]
EGLFS X11 ............................ yes
LinuxFB ................................ yes
VNC .................................... yes
Wenn alles korrekt:
make -j2 #Anzahl verwendeter Kerne, hier 2 Kerne make install
| Option | Erklärung |
|---|---|
-release
|
Debugging aus schalten |
-opengl es2
|
OpenGL ES 2.0 - Offene Grafik Bibliothek für eingebettete Systeme |
-device linux-rasp-pi4-v3d-g++
|
RPI1: |
-device-option CROSS_COMPILE=/opt/qt5.15.2/tools/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
|
Compiler |
-sysroot /opt/qt5.15.2/sysroot
|
sysroot Verzeichnis des Gerätes (RPI) |
-prefix /usr/local/qt5.15'
|
Qt Version für Qt-Creator |
-opensource
|
Die Lizenz wird auf GPL/LGPL gesetzt |
-confirm-license
|
Lizenzbedingungen zustimmen |
-skip qtscript -skip qtwayland -skip qtwebengine
|
Überspringen von Modulen (qtscript, qtwayland, qtwebengine) |
-nomake tests
|
Bauen von Tests aussschließen |
-make libs
|
Bauen von libs hinzufügen |
-pkg-config
|
Um Abhängigkeiten beim Cross-Compiling aufzulösen, erfordert PKG_CONFIG_PATH, PKG_CONFIG_PREFIX |
-no-use-gold-linker
|
GNU Gold Linker wird nicht verwendet |
-v
|
Ausführliche Informationen über jeden Schritt des configure-Prozesses ausgeben |
-recheck
|
Bei einer neuen configuration wird das Build-Verzeichnis aktualisiert |
Kompilierte Dateien auf RPI kopieren:
cd /opt/qt5.15.2
Mit gemounterter SD-Karte:
rsync -avz qt5.15 /mnt/rasp-pi-rootfs/usr/local
Oder übers Netzwerk:
rsync -avz --rsync-path="sudo rsync" qt5.15 pi@cm4:/usr/local/
Update RPI
RPI Bibliotheken updaten:
echo /usr/local/qt5.15/lib | sudo tee /etc/ld.so.conf.d/qt5.15.conf sudo ldconfig
QT Creator
QT 5.15.2 installieren. Sollte Qt Creator nicht starten:
/install_pfad/Qt/Tools/QtCreator/bin/qtcreator
| Fehler | Lösung |
|---|---|
| qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. | export QT_DEBUG_PLUGINS=1
|
| Cannot load library /home/user/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so | sudo apt install --reinstall libxcb-xinerama0
|
Qt Creater starten und unter Werkzeuge ⇒ Einstellung... ⇒ Kits nachfolgende Parameter einstellen.
Qt Versionen
Einstellungen ⇒ Kits ⇒ Qt Versionen ⇒ Hinzufügen
qmake location: /opt/qt5.15.2/qt5.15/bin/qmake
Compiler
Einstellungen ⇒ Kits ⇒ Compilers ⇒ Hinzufügen ⇒ GCC ⇒ C und C++
Compiler path C: /opt/qt5.15.2/tools/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc Compiler path C++: /opt/qt5.15.2/tools/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
Debugger
Einstellungen ⇒ Debuggers ⇒ Hinzufügen
/opt/qt5.15.2/tools/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gdb
Geräte
Einstellungen ⇒ Geräte ⇒ Hinzufügen ⇒ Geberic Linux Device ⇒ IP, user, pass ⇒ Finish
RPI root per SSH erlauben:
sudo vim /etc/ssh/sshd_config PermitRootLogin yes #Auskommentieren und auf yes ändern sudo reboot
Kits
Einstellungen ⇒ Build & Run ⇒ Kits ⇒ Hinzufügen
Device type: Generic Linux Device Device: Welches zuvor erstellt wurde Sysroot: /opt/qt5.15.2/sysroot Compiler: Welches zuvor erstellt wurde Debugger: Welches zuvor erstellt wurde Qt version: Welches zuvor erstellt wurde Qt mkspec: bleibt leer
GammaRay
sudo apt install gammaray
bcm2835
Sollten die bcm2835 Dateien angepasst werden sind die Schritte "Veränderung der .h und .c Datein:" und "Einbinden in Qt Creator" erneut durchzuführen.
Download
Auf RPI herunterladen bcm2835
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.69.tar.gz tar zxvf bcm2835-1.69.tar.gz cd bcm2835-1.69
oder die angepasste Version vom Gitlab-Server bcm2835-custom
git clone https://gitlab.hzdr.de/FWF/Libraries/rpi/bcm2835-custom.git cd bcm2835-custom
Installation
./configure make sudo make check sudo make install
Veränderung der .h und .c Datein:
make clean ./configure make sudo make check sudo make install
Einbinden in Qt Creator
Weiter auf dem RPI:
sudo cp /usr/local/lib/libbcm2835.a /usr/lib/ sudo cp /usr/local/include/bcm2835.h /usr/include
Danach das sysroot auf dem Host wieder syncronisieren:
rsync -avz pi@cm4:/lib sysroot rsync -avz pi@cm4:/usr/include sysroot/usr rsync -avz pi@cm4:/usr/lib sysroot/usr rsync -avz pi@cm4:/opt/vc sysroot/opt
Nach einem rsync vom RPI zum Host ist ein erneutes anpassen der symlinks notwendig:
cd /opt/qt5.15.2 ./sysroot-relativelinks.py sysroot
Im Qt Creator die .pro anpassen
LIBS += -L"/usr/lib" -lbcm2835
Und dann die Header-Datei wie gewünscht einbinden:
#include <bcm2835.h>
Probleme
| Fehler | Lösung |
|---|---|
| [HOST] Qt Creator bricht mit folgender Fehlermeldung ab:
|
export QT_DEBUG_PLUGINS=1
|
| [HOST] Qt Creator bricht mit folgender Fehlermeldung ab:
|
sudo apt install --reinstall libxcb-xinerama0
|
| [RPI] Qt App bricht auf RPI (DSI-Display) mit folgender Fehlermeldung ab:
|
sudo vim /boot/config.txt
|
Quellen
Raspberry Pi Beginners Guide
RaspberryPi2EGLFS
Cross-Compile QT 5.15.2 / Raspberry Pi 4
Qt 5.15 cross compile RPI4 auf Ubuntu 20 LTS
qt cross-compile configure-options