Mobile and Embedded
2020.02.12 22:33

라즈베리파이4에 대한 Qt 5.14.1 크로스컴파일

조회 수 13063 추천 수 0 댓글 1
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부

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기반에서 전체화면으로 실행된다.

 

  • ?
    몽키찡 2020.12.08 12:29

    안녕하세요. 크로스컴파일 완료 후 
    ./프로그램명 -platform eglfs 로 실행시켰더니

    아래와 같은 에러가 뜹니다..

     

    QEGLPlatformContext: eglSwapBuffers failed: 3003

    Could not lock GBM surface front buffer!

    failed to export dumb buffer: Permission denied

     

    sudo 권한으로 실행시에는 아래와 같으 에러가 뜨구요...

    QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'

    Failed to move cursor on screen HDMI1: -13

    Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created.

    Could not set DRM mode for screen HDMI1 (Permission denied)

    Could not queue DRM page flip on screen HDMI1 (Permission denied)

     

     

    ./프로그램명 -platform xcb 로 하면 이상없이 잘됩니다..

    어떤 문제일까요..?


  1. No Image notice

    Qt프로그래밍(QtQuick) Beginner를 위한 글 읽는 순서

    Date2019.01.05 CategoryQML and Qt Quick By운영자 Views422826
    read more
  2. UI 폼(Form)작성 시 탭 순서(Tab Order) 설정

    Date2020.08.24 CategoryGeneral and Desktop Bymakersweb Views14444
    Read More
  3. No Image

    Qt로 데이터를 직렬화(serialization)하는 방법

    Date2020.08.04 CategoryC++ Class Bymakersweb Views8704
    Read More
  4. 최초의 Qt 6.0 스냅샷 제공 (First Qt 6.0 Snapshot Available)

    Date2020.06.21 CategoryQt 6 Byj2doll Views12081
    Read More
  5. Qt MQTT 에 대해서

    Date2020.06.02 CategoryMobile and Embedded Bymakersweb Views11565
    Read More
  6. Embedded Linux 에서 Qt 및 Graphics Stack

    Date2020.05.27 By운영자 Views8295
    Read More
  7. ShaderEffect QML Type을 이용한 버튼 클릭 효과

    Date2020.05.22 CategoryQML and Qt Quick Bymakersweb Views9762
    Read More
  8. Qt기반의 서버와 클라이언트간 SOAP(Simple Object Access Protocol)

    Date2020.05.11 CategoryGeneral and Desktop Bymakersweb Views13512
    Read More
  9. No Image

    재진입(Reentrancy) 및 스레드 안전성(Thread-Safety)

    Date2020.04.19 CategoryC++ Class Bymakersweb Views11057
    Read More
  10. No Image

    Qt 5.15 및 Qt 6의 출시 일정

    Date2020.04.09 CategoryQt 6 Bymakersweb Views10717
    Read More
  11. 콘솔에서 사용자 입력받기

    Date2020.03.22 CategoryGeneral and Desktop Bymakersweb Views60398
    Read More
  12. No Image

    컨테이너 클래스 - QVector

    Date2020.03.17 CategoryC++ Class Bymakersweb Views10612
    Read More
  13. Qt로 작성된 안드로이드 APP에 Splash Screen을 추가

    Date2020.03.10 CategoryMobile and Embedded Bymakersweb Views11468
    Read More
  14. No Image

    QLabel의 텍스트 색과 배경색을 변경

    Date2020.02.25 CategoryC++ Class Bymakersweb Views15530
    Read More
  15. 라즈베리파이4에 대한 Qt 5.14.1 크로스컴파일

    Date2020.02.12 CategoryMobile and Embedded Bymakersweb Views13063
    Read More
  16. QOpenGLWidget 을 투명하게 적용

    Date2020.02.05 CategoryGeneral and Desktop Bymakersweb Views9175
    Read More
  17. No Image

    2020년에 변경되는 Qt 오퍼 (Qt offering changes 2020)

    Date2020.01.31 CategoryGeneral and Desktop Byj2doll Views15087
    Read More
  18. No Image

    Qt로 XML 파싱 : Qt 6에서 업데이트된 (Parsing XML with Qt: Updates for Qt 6)

    Date2020.01.16 CategoryQt 6 Byj2doll Views20770
    Read More
  19. No Image

    Qt 멀티 스레드 프로그래밍 시 유의해야 할 몇 가지

    Date2020.01.13 CategoryGeneral and Desktop Bymakersweb Views13787
    Read More
  20. ApplicationWindow 와 메뉴바(MenuBar)구성

    Date2020.01.04 CategoryQML and Qt Quick Bymakersweb Views14841
    Read More
  21. No Image

    QThread 소개 및 예제

    Date2019.12.25 CategoryC++ Class Bymakersweb Views29015
    Read More
Board Pagination Prev 1 2 3 4 5 6 9 Next
/ 9