zephyr: lvgl: upgrade LVGL to 8.1 build error

Describe the bug

[60/413] Building C object modules/lvgl/CMakeFiles/..__modules__lib__gui__lvgl__zephyr.dir/D_/personal/pinetime/modules/lib/gui/lvgl/src/extra/widgets/win/lv_win.c.obj FAILED: modules/lvgl/CMakeFiles/..__modules__lib__gui__lvgl__zephyr.dir/D_/personal/pinetime/modules/lib/gui/lvgl/src/extra/widgets/win/lv_win.c.obj C:\gnu_arm_embedded\bin\arm-none-eabi-gcc.exe -DKERNEL -DLV_CONF_INCLUDE_SIMPLE=1 -DLV_CONF_PATH=zephyr/lv_conf.h -DNRF52832_XXAA -D_FORTIFY_SOURCE=2 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -ID:/personal/pinetime/zephyr/lib/gui/lvgl -ID:/personal/pinetime/zephyr/include -Izephyr/include/generated -ID:/personal/pinetime/zephyr/soc/arm/nordic_nrf/nrf52 -ID:/personal/pinetime/zephyr/lib/libc/newlib/include -ID:/personal/pinetime/zephyr/soc/arm/nordic_nrf/common/. -ID:/personal/pinetime/zephyr/subsys/bluetooth -ID:/personal/pinetime/zephyr/subsys/settings/include -ID:/personal/pinetime/modules/hal/cmsis/CMSIS/Core/Include -ID:/personal/pinetime/modules/hal/nordic/nrfx -ID:/personal/pinetime/modules/hal/nordic/nrfx/drivers/include -ID:/personal/pinetime/modules/hal/nordic/nrfx/mdk -ID:/personal/pinetime/zephyr/modules/hal_nordic/nrfx/. -ID:/personal/pinetime/modules/lib/gui/lvgl/zephyr/.. -ID:/personal/pinetime/modules/debug/segger/SEGGER -ID:/personal/pinetime/modules/debug/segger/Config -ID:/personal/pinetime/zephyr/modules/segger/. -ID:/personal/pinetime/modules/crypto/tinycrypt/lib/include -ID:/personal/pinetime/pinetime/app/src -ID:/personal/pinetime/pinetime/app/src/bluetooth/service -ID:/personal/pinetime/pinetime/app/src/apps -ID:/personal/pinetime/pinetime/app/src/event/. -Os -imacros D:/personal/pinetime/pinetime/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -imacros D:/personal/pinetime/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=D:/personal/pinetime/pinetime/app=CMAKE_SOURCE_DIR -fmacro-prefix-map=D:/personal/pinetime/zephyr=ZEPHYR_BASE -fmacro-prefix-map=D:/personal/pinetime=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=nano.specs -std=c99 -MD -MT modules/lvgl/CMakeFiles/..__modules__lib__gui__lvgl__zephyr.dir/D_/personal/pinetime/modules/lib/gui/lvgl/src/extra/widgets/win/lv_win.c.obj -MF modules\lvgl\CMakeFiles\..__modules__lib__gui__lvgl__zephyr.dir\D_\personal\pinetime\modules\lib\gui\lvgl\src\extra\widgets\win\lv_win.c.obj.d -o modules/lvgl/CMakeFiles/..__modules__lib__gui__lvgl__zephyr.dir/D_/personal/pinetime/modules/lib/gui/lvgl/src/extra/widgets/win/lv_win.c.obj -c D:/personal/pinetime/modules/lib/gui/lvgl/src/extra/widgets/win/lv_win.c In file included from d:\personal\pinetime\modules\lib\gui\lvgl\lvgl.h:54, from d:\personal\pinetime\modules\lib\gui\lvgl\src\lvgl.h:17, from D:/personal/pinetime/modules/lib/gui/lvgl/src/extra/widgets/win/lv_win.h:16, from D:/personal/pinetime/modules/lib/gui/lvgl/src/extra/widgets/win/lv_win.c:9: d:\personal\pinetime\modules\lib\gui\lvgl\src/widgets/lv_slider.h:22:2: error: #error "lv_slider: lv_bar is required. Enable it in lv_conf.h (LV_USE_BAR 1)" 22 | #error "lv_slider: lv_bar is required. Enable it in lv_conf.h (LV_USE_BAR 1)" | ^~~~~ In file included from d:\personal\pinetime\modules\lib\gui\lvgl\lvgl.h:54, from d:\personal\pinetime\modules\lib\gui\lvgl\src\lvgl.h:17, from D:/personal/pinetime/modules/lib/gui/lvgl/src/extra/widgets/win/lv_win.h:16, from D:/personal/pinetime/modules/lib/gui/lvgl/src/extra/widgets/win/lv_win.c:9: d:\personal\pinetime\modules\lib\gui\lvgl\src/widgets/lv_slider.h:37:29: error: 'LV_BAR_MODE_NORMAL' undeclared here (not in a function); did you mean 'LV_BLEND_MODE_NORMAL'? 37 | LV_SLIDER_MODE_NORMAL = LV_BAR_MODE_NORMAL, | ^~~~~~~~~~~~~~~~~~ | LV_BLEND_MODE_NORMAL d:\personal\pinetime\modules\lib\gui\lvgl\src/widgets/lv_slider.h:38:34: error: 'LV_BAR_MODE_SYMMETRICAL' undeclared here (not in a function) 38 | LV_SLIDER_MODE_SYMMETRICAL = LV_BAR_MODE_SYMMETRICAL, | ^~~~~~~~~~~~~~~~~~~~~~~ d:\personal\pinetime\modules\lib\gui\lvgl\src/widgets/lv_slider.h:39:28: error: 'LV_BAR_MODE_RANGE' undeclared here (not in a function) 39 | LV_SLIDER_MODE_RANGE = LV_BAR_MODE_RANGE | ^~~~~~~~~~~~~~~~~ d:\personal\pinetime\modules\lib\gui\lvgl\src/widgets/lv_slider.h:44:5: error: unknown type name 'lv_bar_t' 44 | lv_bar_t bar; /*Add the ancestor's type first*/ | ^~~~~~~~ d:\personal\pinetime\modules\lib\gui\lvgl\src/widgets/lv_slider.h: In function 'lv_slider_set_value': d:\personal\pinetime\modules\lib\gui\lvgl\src/widgets/lv_slider.h:86:5: warning: implicit declaration of function 'lv_bar_set_value'; did you mean 'lv_slider_set_value'? [-Wimplicit-function-declaration] 86 | lv_bar_set_value(obj, value, anim); | ^~~~~~~~~~~~~~~~ | lv_slider_set_value d:\personal\pinetime\modules\lib\gui\lvgl\src/widgets/lv_slider.h: In function 'lv_slider_set_left_value': d:\personal\pinetime\modules\lib\gui\lvgl\src/widgets/lv_slider.h:97:5: warning: implicit declaration of function 'lv_bar_set_start_value' [-Wimplicit-function-declaration] 97 | lv_bar_set_start_value(obj, value, anim); | ^~~~~~~~~~~~~~~~~~~~~~ d:\personal\pinetime\modules\lib\gui\lvgl\src/widgets/lv_slider.h: In function 'lv_slider_set_range': d:\personal\pinetime\modules\lib\gui\lvgl\src/widgets/lv_slider.h:108:5: warning: implicit declaration of function 'lv_bar_set_range'; did you mean 'lv_slider_set_range'? [-Wimplicit-function-declaration] 108 | lv_bar_set_range(obj, min, max); | ^~~~~~~~~~~~~~~~ | lv_slider_set_range d:\personal\pinetime\modules\lib\gui\lvgl\src/widgets/lv_slider.h: In function 'lv_slider_set_mode': d:\personal\pinetime\modules\lib\gui\lvgl\src/widgets/lv_slider.h:118:5: warning: implicit declaration of function 'lv_bar_set_mode'; did you mean 'lv_slider_set_mode'? [-Wimplicit-function-declaration] 118 | lv_bar_set_mode(obj, (lv_bar_mode_t)mode); | ^~~~~~~~~~~~~~~ | lv_slider_set_mode d:\personal\pinetime\modules\lib\gui\lvgl\src/widgets/lv_slider.h:118:27: error: 'lv_bar_mode_t' undeclared (first use in this function); did you mean 'lv_fs_mode_t'? 118 | lv_bar_set_mode(obj, (lv_bar_mode_t)mode); | ^~~~~~~~~~~~~ | lv_fs_mode_t d:\personal\pinetime\modules\lib\gui\lvgl\src/widgets/lv_slider.h:118:27: note: each undeclared identifier is reported only once for each function it appears in d:\personal\pinetime\modules\lib\gui\lvgl\src/widgets/lv_slider.h:118:41: error: expected ')' before 'mode' 118 | lv_bar_set_mode(obj, (lv_bar_mode_t)mode); | ^~~~ | ) d:\personal\pinetime\modules\lib\gui\lvgl\src/widgets/lv_slider.h: In function 'lv_slider_get_value': d:\personal\pinetime\modules\lib\gui\lvgl\src/widgets/lv_slider.h:132:12: warning: implicit declaration of function 'lv_bar_get_value'; did you mean 'lv_slider_get_value'? [-Wimplicit-function-declara Please also mention any information which could help others to understand the problem you’re facing:

  • What target platform are you using? pinetime_devkit0
  • What have you tried to diagnose or workaround this issue? find out the Kconfig maybe not correct

To Reproduce Steps to reproduce the behavior:

  1. enable CONFIG_LVGL=y CONFIG_LV_CONF_MINIMAL=y build and see error

Expected behavior

Impact

Logs and console output

Environment (please complete the following information):

Additional context

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Seems to fix the problem. I think Zephyr should always use CONFIG_LV_CONF_MINIMAL=y, and manually enable other parts as needed. I’m not sure why LVGL doesn’t do that, ROM usage almost doubles for nothing in the samples/subsys/display/lvgl sample…

Right, this is only addressed in master.

  50 #ifdef CONFIG_LV_COLOR_DEPTH
  51     #define _LV_KCONFIG_PRESENT
  52 #endif
1444 #ifndef LV_USE_SLIDER
1445     #ifdef _LV_KCONFIG_PRESENT
1446         #ifdef CONFIG_LV_USE_SLIDER
1447             #define LV_USE_SLIDER CONFIG_LV_USE_SLIDER
1448         #else
1449             #define LV_USE_SLIDER 0
1450         #endif
1451     #else
1452         #define LV_USE_SLIDER     1   /*Requires: lv_bar*/
1453     #endif
1454 #endif

You also just replace lv_conf_internal_gen.py with this latest version and run it.

Seems to be a bug (or an assumption) in how LVGL uses Kconfig (lv_conf_internal.h):

#ifndef LV_USE_SLIDER
#  ifdef CONFIG_LV_USE_SLIDER
#    define LV_USE_SLIDER CONFIG_LV_USE_SLIDER
#  else
#    define LV_USE_SLIDER     1   /*Requires: lv_bar*/
#  endif
#endif

If CONFIG_LV_USE_SLIDER=n, there’s nothing in autoconf.h. Meaning, we’ll end up with LV_USE_SLIDER defined as 1 (enabled). This also happens to many other widgets (maybe that explains the increase in ROM usage).

LVGL should do instead (assuming it has an equivalent to IS_ENABLED):

#ifndef LV_USE_SLIDER
#   define LV_USE_SLIDER IS_ENABLED(CONFIG_LV_USE_SLIDER)
#endif

It seems like a big regression for the Zephyr users.

cc: @kisvegabor @brgl @jfischer-no