eez-open / eez-framework

Library for EEZ Flow and EEZ-GUI
MIT License
18 stars 10 forks source link

LVGL9.2 ESP32 IDF build Error #12

Open 666wsp opened 2 months ago

666wsp commented 2 months ago

Hello! I ported eez-framework to esp32 idf architecture and compiled it with lvgl9.2, idf5.4.0 and it reported an error with two main parts:

The first part of the error is as follows:

  1. error: invalid use of incomplete type 'lv_roller_t' {aka 'struct lv_roller_t'} 300 | size_t numPages = roller->inf_page_cnt; The second part reports an error: 2, /eez-framework/src/eez/flow/components/lvgl.cpp:224:63: error: invalid conversion from 'lv_state_t' {aka 'short unsigned int'} to 'lvobj flag_t' [-fpermissive] 224 | if (booleanValue) lv_obj_add_flag(target, flag); | ^~~~ | ^~~~ | lv_state_t {aka short unsigned int}

components/eez-framework/src/eez/flow/components/lvgl.cpp:225:52: error: invalid conversion from 'lv_state_t' {aka 'short unsigned int'} to ' lv_obj_flag_t' [-fpermissive] 225 | else lv_obj_clear_flag(target, flag); | lv_obj_clear_flag(target, flag); lv_obj_flag(target, flag) | ^~~~ | ^~~~ | lv_state_t {aka short unsigned int}

I can't fix the first part of the error, I don't know where it's caused by not setting the right settings, the second part of the error looks like the book data type doesn't match, I forced the type conversion so it won't report the error, forced the type code: if (booleanValue) lv_obj_add_flag(target, (lv_obj_flag_t)flag); else lv_obj_clear_flag(target, flag); ^~~~ | | lv_state_t {aka short unsigned int} else lv_obj_clear_flag(target, (lv_obj_flag_t)flag);

Translated with DeepL.com (free version)

I compiled the cmake configuration as follows `if(ESP_PLATFORM) file(GLOB_RECURSE SOURCES ./src/eez/.cpp ./src/eez/.c )

idf_component_register(
    SRCS ${SOURCES}
    INCLUDE_DIRS ./src ./src/eez/libs/agg
    REQUIRES lvgl__lvgl
)

target_compile_definitions(
    ${COMPONENT_LIB}
    PUBLIC EEZ_FOR_LVGL LV_LVGL_H_INCLUDE_SIMPLE)

target_compile_options(
    ${COMPONENT_LIB}
    PRIVATE -Wno-error=dangling-pointer)

else() cmake_minimum_required(VERSION 3.12)

include_directories(
    ./src
    ./src/eez/libs/agg
)

file(GLOB_RECURSE SOURCES
    ./src/eez/*.cpp
    ./src/eez/*.c
)

ADD_LIBRARY(eez-framework STATIC ${SOURCES})

target_include_directories(eez-framework SYSTEM PUBLIC ./src ./src/eez/libs/agg)

endif() ` Under lvgl 8.4 I followed this cmake and it works fine

mvladic commented 2 months ago

You should update eez-framework.

Or you don't need to use eez-framework at all if you enable this option in Settings - Build:

image

For more information check this.

666wsp commented 2 months ago

You should update eez-framework.

Or you don't need to use eez-framework at all if you enable this option in Settings - Build:

image

For more information check this.

I did what you did and it still reports an error 微信截图_20240914015554 微信截图_20240914015645 微信截图_20240914015715

mvladic commented 2 months ago

You don't have the latest version of eez-framework! Your version:

image

Latest version:

image

https://github.com/eez-open/eez-framework/blob/master/src/eez/flow/components/lvgl.cpp#L222

666wsp commented 2 months ago

You don't have the latest version of eez-framework! Your version:

image

Latest version:

image

https://github.com/eez-open/eez-framework/blob/master/src/eez/flow/components/lvgl.cpp#L222

Thank you very much for your help, I fixed it indeed did not download and update to the latest library, it is strange that I use vscode git to switch branches but can not switch to the latest, I directly download can go to the latest, it is possible that my network problem!

Here I got an error compiling as well, I got an error in component->type ! = defs_v3::COMPONENT_TYPE_USER_WIDGET_WIDGET || component->type >= defs_v3::FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE I added a bracket '()' and it worked, I don't know if it's a bug or just a difference in the compilation system that caused the error. 微信截图_20240914023905

mvladic commented 2 months ago

Your fix is not correct, it should be:

image

I fixed this in eez-framework.

666wsp commented 2 months ago

Your fix is not correct, it should be:

image

I fixed this in eez-framework.

Your fix is not correct, it should be:

image

I fixed this in eez-framework.

Okay, I'll change it your way.

mvladic commented 2 months ago

BTW Normally, this is not an error, but because of -Werror=parentheses, warning is promoted to the error.

image

We had report of similar case recently.

In C/C++ following is the same: a && b || c and (a && b) || c - and both are correct. Operator && has higher priority than ||. By habit, I never use parentheses for such cases.

666wsp commented 2 months ago

BTW Normally, this is not an error, but because of -Werror=parentheses, warning is promoted to the error.

image

We had report of similar case recently.

In C/C++ following is the same: a && b || c and (a && b) || c - and both are correct. Operator && has higher priority than ||. By habit, I never use parentheses for such cases.

Ok, thank you very much for your reply, I've taken care of it now and can happily play with EEZ Studio!