espressif / esp-aws-iot

AWS IoT SDK for ESP32 based chipsets
Apache License 2.0
256 stars 154 forks source link

[BUG] Compile with GNU fails. (CA-258) #154

Open phelter opened 1 year ago

phelter commented 1 year ago

When compiling with GNU 10 (default for ubuntu 22.04)

Have following error:

esp_aws_iot-src/libraries/ota-for-aws-iot-embedded-sdk/port/ota_pal.c:162:92: error: comparison of distinct pointer types lacks a cast [-Werror]
  162 |     return( pFileContext != NULL && ota_ctx.cur_ota == pFileContext && pFileContext->pFile == ( uint8_t * ) &ota_ctx );

Note I am compiling with:

add_compile_options(
    $<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wall>
    $<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wextra>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wpedantic> # Note not used in GNU to allow C99 designated initializers.
    $<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Werror>
)

Also when I do this I get quite a few warnings in ota and other directories - might want to consider compiling with these and cleaning up these issues. Some/most of the issues are related to the imported libraries from FreeRTOS, but there are a few in the port and config files.

Here's my cmake file that I use to compile Natively (outside esp-idf environment). Reason - to allow mocking and native compiles which are restricted when using the esp_idf cmake-like-wrapped environment.

esp_aws_iot.cmake.txt