lvgl / lv_port_linux

LVGL configured to work with a standard Linux framebuffer
MIT License
208 stars 140 forks source link

Compilation fails with Clang 15 #25

Closed cbrake closed 1 year ago

cbrake commented 1 year ago

We are using clang 15 in the latest version of Yoe and getting the following compile error:

[cbrake@ceres yoe-distro]$ ./build/tmp/work/cortexa35-yoe-linux/lvgl-demo-fb/1.0-r0/temp/run.do_compile
NOTE: cmake --build /scratch/yoe/yoe-distro/build/tmp/work/cortexa35-yoe-linux/lvgl-demo-fb/1.0-r0/lvgl-demo-fb-1.0/ --target all --
[129/441] Building C object lvgl/CMakeFiles/lvgl.dir/src/hal/lv_hal_tick.c.o
FAILED: lvgl/CMakeFiles/lvgl.dir/src/hal/lv_hal_tick.c.o 
/scratch/yoe/yoe-distro/build/tmp/work/cortexa35-yoe-linux/lvgl-demo-fb/1.0-r0/recipe-sysroot-native/usr/bin/aarch64-yoe-linux/aarch64-yoe-linux-clang -DLV_CONF_INCLUDE_SIMPLE -DLV_LVGL_H_INCLUDE_SIMPLE -I/scratch/yoe/yoe-distro/workspace/sources/lvgl-demo-fb/. -isystem /scratch/yoe/yoe-distro/workspace/sources/lvgl-demo-fb/lvgl -target aarch64-yoe-linux  -mcpu=cortex-a35 -march=armv8-a+crc+crypto -mlittle-endian --dyld-prefix=/usr -Qunused-arguments -ffile-compilation-dir=. -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security  --sysroot=/scratch/yoe/yoe-distro/build/tmp/work/cortexa35-yoe-linux/lvgl-demo-fb/1.0-r0/recipe-sysroot  -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/scratch/yoe/yoe-distro/workspace/sources/lvgl-demo-fb=/usr/src/debug/lvgl-demo-fb/1.0-r0  -fdebug-prefix-map=/scratch/yoe/yoe-distro/workspace/sources/lvgl-demo-fb=/usr/src/debug/lvgl-demo-fb/1.0-r0  -fmacro-prefix-map=/scratch/yoe/yoe-distro/build/tmp/work/cortexa35-yoe-linux/lvgl-demo-fb/1.0-r0/lvgl-demo-fb-1.0/=/usr/src/debug/lvgl-demo-fb/1.0-r0  -fdebug-prefix-map=/scratch/yoe/yoe-distro/build/tmp/work/cortexa35-yoe-linux/lvgl-demo-fb/1.0-r0/lvgl-demo-fb-1.0/=/usr/src/debug/lvgl-demo-fb/1.0-r0  -fdebug-prefix-map=/scratch/yoe/yoe-distro/build/tmp/work/cortexa35-yoe-linux/lvgl-demo-fb/1.0-r0/recipe-sysroot=  -fmacro-prefix-map=/scratch/yoe/yoe-distro/build/tmp/work/cortexa35-yoe-linux/lvgl-demo-fb/1.0-r0/recipe-sysroot=  -fdebug-prefix-map=/scratch/yoe/yoe-distro/build/tmp/work/cortexa35-yoe-linux/lvgl-demo-fb/1.0-r0/recipe-sysroot-native= -MD -MT lvgl/CMakeFiles/lvgl.dir/src/hal/lv_hal_tick.c.o -MF lvgl/CMakeFiles/lvgl.dir/src/hal/lv_hal_tick.c.o.d -o lvgl/CMakeFiles/lvgl.dir/src/hal/lv_hal_tick.c.o -c /scratch/yoe/yoe-distro/workspace/sources/lvgl-demo-fb/lvgl/src/hal/lv_hal_tick.c
/scratch/yoe/yoe-distro/workspace/sources/lvgl-demo-fb/lvgl/src/hal/lv_hal_tick.c:77:12: error: call to undeclared function 'custom_tick_get'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    return LV_TICK_CUSTOM_SYS_TIME_EXPR;
           ^
/scratch/yoe/yoe-distro/workspace/sources/lvgl-demo-fb/./lv_conf.h:91:43: note: expanded from macro 'LV_TICK_CUSTOM_SYS_TIME_EXPR'
    #define LV_TICK_CUSTOM_SYS_TIME_EXPR (custom_tick_get())    /*Expression evaluating to current system time in ms*/
                                          ^
1 error generated.
[152/441] Building C object lvgl/CMakeFiles/lvgl.dir/src/extra/widgets/chart/lv_chart.c.o
ninja: build stopped: subcommand failed.
WARNING: ./build/tmp/work/cortexa35-yoe-linux/lvgl-demo-fb/1.0-r0/temp/run.do_compile:152 exit 1 from 'eval ${DESTDIR:+DESTDIR=${DESTDIR} } cmake --build '/scratch/yoe/yoe-distro/build/tmp/work/cortexa35-yoe-linux/lvgl-demo-fb/1.0-r0/lvgl-demo-fb-1.0/' "$@" -- ${EXTRA_OECMAKE_BUILD}'
WARNING: Backtrace (BB generated script): 
        #1: cmake_runcmake_build, ./build/tmp/work/cortexa35-yoe-linux/lvgl-demo-fb/1.0-r0/temp/run.do_compile, line 152
        #2: cmake_do_compile, ./build/tmp/work/cortexa35-yoe-linux/lvgl-demo-fb/1.0-r0/temp/run.do_compile, line 146
        #3: do_compile, ./build/tmp/work/cortexa35-yoe-linux/lvgl-demo-fb/1.0-r0/temp/run.do_compile, line 141
        #4: main, ./build/tmp/work/cortexa35-yoe-linux/lvgl-demo-fb/1.0-r0/temp/run.do_compile, line 165

If I set LV_TICK_CUSTOM to 0 in lv_conf.h, then it compiles and runs.

Not sure the best way to fix this up, so thought I would start a discussion here.

embeddedt commented 1 year ago

There really should be an extern uint32_t custom_tick_get(void) added in lv_conf.h in that section. I wonder why there was no warning before.