Utangulizi
Hii ni mwongozo wa Qt 5.15.2 ya Raspberry Pi 4 na kuisakinisha kwenye Moduli ya Compute 4. Ni sasisho kwa chapisho langu la blogi Qt kwenye Raspberry Pi 4, na tofauti kwamba wakati huu ninatumia Raspberry Pi OS Lite (pakua hapa: https://www.raspberrypi.org/software/operating-systems/), toleo la Qt 5.15.2 na Ubuntu 20 LTS kama kompyuta ya msalaba kwenye mashine ya kawaida.
Vyanzo
Mbali na chapisho langu la zamani la blogi (tazama hapo juu), pia nilitumia vyanzo vifuatavyo:
- na Uvindu Wijesinghe: https://github.com/UvinduW/Cross-Compiling-Qt-for-Raspberry-Pi-4
Makini
Kuna sasisho kwa nakala hii, ambayo ina mkusanyiko wa msalaba kwa Raspberry Pi, Qt6 na Ubuntu 22.04 LTS. Fuata kiungo hiki, ikiwa unahitaji matoleo mapya zaidi.
Raspberry Pi OS Lite
Sakinisha Raspberry Pi OS Lite kwenye Raspberry Pi 4 au kwenye moduli ya Raspberry Compute 4 kama ilivyoelezwa katika chapisho langu la blogi Kusakinisha Raspberry Pi OS kwenye Raspberry Compute Module 4 .
Qt 5.15.2 kwenye Ubuntu 20 LTS
Baada ya Raspberry Pi OS imewekwa kwenye Moduli ya Compute na buti za Raspberry kutoka kwa kumbukumbu ya eMMC, ni wakati wa kusakinisha programu inayohitajika kwenye Raspberry na kwenye mashine ya Ubuntu.
Raspberry Compute Module 4
Hatua zilizoonyeshwa hapa chini zinapaswa pia kufanya kazi kwenye "kawaida" Raspberry Pi 4.
Baada ya kuwasha Pi 4, fungua menyu ya usanidi.
sudo raspi-config
Kwa usanidi wetu tunahitaji "SSH" na "GL (Fake KMS)". Angalia picha mbili zifuatazo.- Kisha ongeza vyanzo vya maendeleo kwa /etc/apt/sources.list. Ili kufanya hivyo, ongeza mstari ufuatao:
deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
- Kisha sasisha mfumo kwa amri zifuatazo:sudo apt-get update
sudo apt-get dist-upgrade
sudo reboot
sudo rpi-update
sudo reboot
- Na kisha sakinisha vifurushi vya Qt na maendeleo vinavyohitajika:sudo apt-get build-dep qt5-qmake
sudo apt-get build-dep libqt5gui5
sudo apt-get build-dep libqt5webengine-data
sudo apt-get build-dep libqt5webkit5
sudo apt-get install libudev-dev libinput-dev libts-dev libxcb-xinerama0-dev libxcb-xinerama0 gdbserver
- Kisha unda saraka ya RaspberryQt:sudo mkdir /usr/local/qt5.15
sudo chown -R pi:pi /usr/local/qt5.15
Mashine ya Ubuntu
Kompyuta au mashine pepe iliyo na Ubuntu 20 LTS iliyosakinishwa inahitajika.
Kwanza kabisa, leta Ubuntu hadi sasa na usakinishe maktaba zingine zinazohitajika:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install gcc git bison python gperf pkg-config gdb-multiarch
sudo apt install build-essential
Kisha - ikiwa haipatikani tayari - unda kitufe cha ssh na usakinishe kwenye Raspberry, ili haraka ya nenosiri isionekane na kila rsync na jina la mtumiaji na nenosiri lazima liingizwe. Kuna maagizo ya kutosha kwenye mtandao, kwa hivyo nitajihifadhi maelezo ya kina hapa.
Unda muundo wa saraka kwa maktaba za Raspberry
Kwa faili zinazohitajika, ninaunda muundo wa saraka ifuatayo chini ya Nyaraka / Qt-CrossCompile-RaspberryPi/raspberrypi4:
sudo mkdir ~/Documents/Qt-CrossCompile-RaspberryPi/raspberrypi4
sudo mkdir ~/Documents/Qt-CrossCompile-RaspberryPi/raspberrypi4/build
sudo mkdir ~/Documents/Qt-CrossCompile-RaspberryPi/raspberrypi4/tools
sudo mkdir ~/Documents/Qt-CrossCompile-RaspberryPi/raspberrypi4/sysroot
sudo mkdir ~/Documents/Qt-CrossCompile-RaspberryPi/raspberrypi4/sysroot/usr
sudo mkdir ~/Documents/Qt-CrossCompile-RaspberryPi/raspberrypi4/sysroot/opt
sudo chown -R 1000:1000 ~/Documents/Qt-CrossCompile-RaspberryPi/raspberrypi4
cd ~/Documents/Qt-CrossCompile-RaspberryPi/raspberrypi4
Pakua Rasilimali za Qt
Tunapakua rasilimali za Qt na kuzifungua kwenye saraka ya raspberrypi4:
sudo wget http://download.qt.io/archive/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz
sudo tar xfv qt-everywhere-src-5.15.2.tar.xz
Sasa tunahitaji kurekebisha faili ya mkspec kidogo ili tuweze kuitumia na mkusanyaji wetu. Ili kufanya hivyo, fuata maagizo yafuatayo:
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
Pakua Mkusanyaji wa Msalaba
Kama mkusanyaji wa msalaba ninatumia toleo la Linaro 7.4.1. Ili kufanya hivyo, badilisha kwenye saraka ya zana na upakue na ufungue mkusanyaji:
cd tools
sudo wget https://releases.linaro.org/components/toolchain/binaries/7.4-2019.02/arm-linux-gnueabihf/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf.tar.xz
tar xfv gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf.tar.xz
Rsync ya Maktaba ya Raspberry
Sasa tunahitaji maktaba asili kutoka kwa Raspberry Pi, ambayo tunanakili kwenye saraka za Ubuntu na rsync:
cd ..
rsync -avz --rsync-path="sudo rsync" --delete pi@192.168.1.7:/lib sysroot/
rsync -avz --rsync-path="sudo rsync" --delete pi@192.168.1.7:/usr/include sysroot/usr/
rsync -avz --rsync-path="sudo rsync" --delete pi@192.168.1.7:/usr/lib sysroot/usr/
rsync -avz --rsync-path="sudo rsync" --delete pi@192.168.1.7:/opt/vc sysroot/opt/
Sasa tunapaswa kusafisha viungo vya mfano ambavyo vilinakiliwa na rsync ili vionyeshe faili sahihi za asili. Kuna hati ndogo ya Python ya kupakua:
wget https://raw.githubusercontent.com/riscv/riscv-poky/master/scripts/sysroot-relativelinks.py
Kisha fanya hati iweze kutekelezwa na uiite:
sudo chmod +x sysroot-relativelinks.py
./sysroot-relativelinks.py sysroot
Kukusanya Qt
Sasa tunaweza kusanidi ujenzi na kisha kuikusanya.
cd build
../qt-everywhere-src-5.15.2/configure -release -opengl es2 -eglfs -device linux-rasp-pi4-v3d-g++ -device-option CROSS_COMPILE=~/Documents/Qt-CrossCompile-RaspberryPi/raspberrypi4/tools/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot ~/Documents/Qt-CrossCompile-RaspberryPi/raspberrypi4/sysroot -prefix /usr/local/qt5.15 -extprefix ~/Documents/Qt-CrossCompile-RaspberryPi/raspberrypi4/qt5.15 -opensource -confirm-license -skip qtscript -skip qtwayland -skip qtwebengine -nomake tests -make libs -pkg-config -no-use-gold-linker -v -recheck
Baada ya dakika chache, hati inapaswa kukamilika na masharti yafuatayo ya EGLFS yanapaswa kuwekwa au kutowekwa.
QPA backends:
DirectFB ............................... no
EGLFS .................................. yes [SHOULD BE YES]
EGLFS details:
EGLFS OpenWFD ........................ no
EGLFS i.Mx6 .......................... no
EGLFS i.Mx6 Wayland .................. no
EGLFS RCAR ........................... no
EGLFS EGLDevice ...................... yes [SHOULD BE YES]
EGLFS GBM ............................ yes
EGLFS VSP2 ........................... no
EGLFS Mali ........................... no
EGLFS Raspberry Pi ................... no [SHOULD BE NO]
EGLFS X11 ............................ yes
LinuxFB ................................ yes
VNC .................................... yes
Ikiwa hii sio kesi au ikiwa ujumbe mwingine wowote wa hitilafu unaonekana, tafadhali chunguza na usafishe. Ikiwa unataka kuendesha hati ya usanidi tena na vigezo vilivyobadilishwa, tafadhali futa yaliyomo kwenye saraka ya ujenzi kabla.
Ikiwa kila kitu ni sawa, basi endesha tengeneza na utengeneze amri za kusakinisha.
make -j4
make install
Sakinisha faili zilizokusanywa kwenye Raspberry
Ikiwa mkusanyiko umefanikiwa, faili zilizokusanywa - ziko kwenye saraka ya qt5.15 - zinaweza kunakiliwa kwa Raspberry Pi. Tena, tunafanya hivyo kwa kutumia amri ya rsync.
rsync -avz --rsync-path="sudo rsync" qt5.15 pi@192.168.1.7:/usr/local/
Usanidi wa QtCreator
Katika chapisho linalofuata la blogi nitaelezea jinsi ya kutumia QtCreator kwa matumizi na maktaba zilizokusanywa.