한국어
Qt
 

Raspberry Pi 4에 대한 Qt5.14 크로스컴파일을 우분투 18.04에서 진행해보았다. 2019년 10월 경에 Raspberry Pi 4 에서 사용되는 Broadcom사의 V3D에대한 Mesa 그래픽 스택의 업데이트 소식을 공유한 적이 있었는데 (https://makersweb.net/news/15210) 이번에 직접 Qt를 올려봄..

 

Mesa 19.3 부터 Raspberry Pi 4 에서 사용되는 Broadcom "V3D" Gallium3D 드라이버는 OpenGL ES 3.1을 지원한다. 그러므로 Mesa를 먼저 크로스컴파일 하고 Qt를 구축한다. (Broadcom 스택이 아님에 주의 할 것.)

 

라즈베리파이4 운영체제는 라즈비안 buster 를 사용하였다. 이미지를 다운로드 받고 sd카드에 쓴다.

 

sd카드를 우분투 pc에 장착하면 boot, rootfs 으로 마운트된다. 빌드 후 여기에 직접 복사할 예정..

 

우분투 18.04에서 크로스툴체인 패키지 설치

 

sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf ccache pkg-config-arm-linux-gnueabihf
 
drm 크로스 컴파일
mesa 및 drm빌드는 meson빌드 시스템을 사용하므로 크로스 컴파일을 위한 구성파일 작성.
cross_file
[binaries]
c = '/usr/lib/ccache/arm-linux-gnueabihf-gcc'
cpp = '/usr/lib/ccache/arm-linux-gnueabihf-g++'
ar = '/usr/bin/arm-linux-gnueabihf-ar'
strip = '/usr/bin/arm-linux-gnueabihf-strip'
pkgconfig = '/usr/bin/arm-linux-gnueabihf-pkg-config'
 
[host_machine]
system = 'linux'
cpu_family = 'arm'
cpu = 'armv8hl'
endian = 'little'
 
sudo apt-get install valgrind
 
git clone git://anongit.freedesktop.org/mesa/drm
cd drm
 
빌드구성명령
meson build/ \
    --cross-file=$HOME/pi/mesa/cross_file \
    --prefix=/usr \
    --libdir=lib/arm-linux-gnueabihf \
    "$@"
 
ninja -C build/

 

sudo env DESTDIR=/ ninja -C build/ install

 

sd카드 rootfs에도 설치한다.

 

 

Mesa 크로스 컴파일

추가 필요패키지 (모든 의존성 패키지들을 크로스 컴파일 할 수 없으므로 apt 를 이용하여 설치)
sudo apt-get install \
    flex bison python-mako \
    libxcb-dri3-dev:armhf libxcb-dri2-0-dev:armhf \
    libxcb-glx0-dev:armhf libx11-xcb-dev:armhf \
    libxcb-present-dev:armhf libxcb-sync-dev:armhf \
    libxshmfence-dev:armhf \
    libxdamage-dev:armhf libxext-dev:armhf libxfixes-dev:armhf \
    libexpat1-dev:armhf libudev-dev:armhf gettext \
    libxxf86vm-dev:armhf libxrandr-dev:armhf
 
* 설치가 안되면 다음 링크 참조
https://askubuntu.com/questions/1061979/cross-compile-for-armhf-and-install-a-static-library
 
git clone git://anongit.freedesktop.org/mesa/mesa
cd mesa
 
빌드구성명령
meson build/ \
  --cross-file=$HOME/pi/mesa/cross_file \
  --prefix=/usr \
  --libdir=lib/arm-linux-gnueabihf \
  -Dtexture-float=true \
  -Ddri-drivers= \
  -Dgallium-drivers=v3d,swrast \
  -Dvulkan-drivers= \
  -Dllvm=false \
  -Dplatforms=x11,drm,surfaceless \
  -Dlibunwind=false \
  -Dllvm=false \
  "$@"

 

 

ninja -C build/
sudo env DESTDIR=/ ninja -C build/ install

 

sd카드 rootfs에도 설치한다.

 

 

Qt 5.14.1 크로스 컴파일

다음 링크 또는 git을 통한 Qt 소스코드 다운로드(https://download.qt.io/archive/qt/)

 

빌드구성

pjk@ubuntu:~/pi/qt/qt5$ ./configure -opensource -confirm-license -release -opengl es2 -device linux-rasp-pi4-v3d-g++ -device-option CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- -prefix /usr/local/qt5pi -extprefix $HOME/pi/qt5 -hostprefix $HOME/pi/qt5 -nomake examples -nomake tests -no-use-gold-linker -qt-pcre -skip qtscript -skip qttools

 

make -j4

make install

 

이후 sd카드 rootfs에(/usr/local/qt5pi)도 설치하고 sd카드를 라즈베리파이4에 장착하고 부팅 후 ssh를 활성화한다.

 

호스트(우분투)에서 QtCreator IDE 설정을 하고 예제를 컴파일 하여 라즈베리파이4에 배포한다. 응용프로그램을 "-platform eglfs" 옵션으로 실행하면 X기반에서 전체화면으로 실행된다.

 

번호 제목 글쓴이 날짜 조회 수
공지 Qt프로그래밍(QtQuick) Beginner를 위한 글 읽는 순서 운영자 2019.01.05 85903
179 Qt 응용프로그램에 Web 구성 요소를 표시 with Servo file makersweb 2024.04.27 54
178 Qt Creator 에서 GitHub Copilot 사용하기 file makersweb 2024.04.13 288
177 Qbs 프로젝트를 정의하기 위해 사용되는 몇가지 중요한 아이템들 file makersweb 2019.10.13 296
176 QtQuick 애플리케이션에 Rive 애니메이션 통합 makersweb 2024.03.31 337
175 Qt 6.4에 추가될 Qt Quick 3D Physics file makersweb 2022.08.07 344
174 HTTPS URL을 연결할 때 SslHandshakeFailedError 오류 makersweb 2022.07.31 358
173 Qt Android 앱에 AdMob 배너달기 file makersweb 2021.12.04 392
172 그래픽 소프트웨어에서 디자인 내보내기 (Exporting Designs from Graphics Software) j2doll 2020.12.25 413
171 Binding 타입으로 객체 속성 간 묶기 makersweb 2022.03.04 422
170 Base64로 인코딩된 파일을 복원 makersweb 2023.08.06 448
169 VirtualKeyboard 스타일 커스터 마이징 makersweb 2022.03.13 462
168 Qt Quick Controls 2에 네이티브 데스크탑 스타일 추가 file makersweb 2020.11.23 487
167 Android 애플리케이션 서명 구성 file makersweb 2023.12.17 497
166 앱을 종료할 때 QML 바인딩 오류를 피하는 방법 makersweb 2021.08.08 498
165 안드로이드용 Qt 6.2 makersweb 2021.10.02 504
164 성능 고려 및 제안 사항 makersweb 2022.03.07 505
163 하드디스크 드라이브 여유 공간 계산 file makersweb 2023.01.15 508
162 QRhi 에 대해서 file makersweb 2023.12.29 527
161 Qt Safe Renderer 개요 file makersweb 2022.09.08 545
160 QML의 사용자 정의 Image makersweb 2023.09.17 556