0%

QT5 run on Raspberry Pi

Raspberry pi Run QT5 Example

rpi3 qt5 、 rpi3差異

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
buildroot/configs (master)$ diff raspberrypi3_defconfig raspberrypi3_qt5we_defconfig 
4a5
> BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
22a24,32
> # Build Qt5 WebEngine
> BR2_PACKAGE_LIBERATION=y
> BR2_PACKAGE_QT5=y
> BR2_PACKAGE_QT5BASE_EXAMPLES=y
> BR2_PACKAGE_QT5BASE_GIF=y
> BR2_PACKAGE_QT5BASE_JPEG=y
> BR2_PACKAGE_QT5BASE_PNG=y
> BR2_PACKAGE_QT5WEBENGINE=y
> BR2_PACKAGE_QT5WEBENGINE_PROPRIETARY_CODECS=y
23a34,36
> BR2_PACKAGE_RPI_USERLAND=y
> BR2_PACKAGE_CA_CERTIFICATES=y
> BR2_PACKAGE_NTP=y
33c46
< BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
---
> BR2_TARGET_ROOTFS_EXT2_SIZE="360M"
34a48
> BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
37c51
< BR2_ROOTFS_POST_SCRIPT_ARGS="--add-pi3-miniuart-bt-overlay"
---
> BR2_ROOTFS_POST_SCRIPT_ARGS="--add-pi3-miniuart-bt-overlay --gpu_mem_1024=200"

編譯

1
2
3
$git clone https://github.com/buildroot/buildroot.git
$make raspberrypi3_qt5we_defconfig
$make j$(nproc)
1
2
3
4
#qml -v
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
qml binary version 1.1
built with Qt version 5.12.4

執行結果:

example location:

  1. /usr/lib/qt/examples/widgets/widgets
  2. /usr/lib/qt/examples/gui
analogclock
digitalclock

NOTE:

  1. BR2_TARGET_ROOTFS_EXT2_SIZE=”360M” set to “512M”
  2. 找不到stdlib.h,參考:https://bugreports.qt.io/browse/QTBUG-53367
    1
    2
    3
    4
    /opt/ext-toolchain/arm-buildroot-linux-gnueabihf/include/c++/6.1.0/cstdlib:75:25: fatal error: stdlib.h: No such file or directory
    #include_next <stdlib.h>
    ^
    compilation terminated."