espressif / esp-azure

SDK to connect ESP8266 and ESP32 to Microsoft Azure IoT services
176 stars 92 forks source link

tls error when compiling on esp-idf 5 (CA-295) #134

Open preveen-stack opened 1 year ago

preveen-stack commented 1 year ago

I was tying to compile the sample application iothub_client_sample_mqtt with esp-idf 5.0.0 and is getting the below errors. Has anybody come across them?

esp5/esp-idf/esp-azure/port/src/tlsio_esp_tls.c:127:5: error: implicit declaration of function 'esp_tls_conn_delete'; did you mean 'esp_tls_conn_write'? [-Werror=implicit-function-declaration]
  127 |     esp_tls_conn_delete(tls_io_instance->esp_tls_handle);
      |     ^~~~~~~~~~~~~~~~~~~
      |     esp_tls_conn_write
/esp5/esp-idf/esp-azure/port/src/tlsio_esp_tls.c: In function 'tlsio_esp_tls_create':
/Users/preveen/esp5/esp-idf/esp-azure/port/src/tlsio_esp_tls.c:219:59: error: invalid application of 'sizeo' to incomplete type 'esp_tls_t' {aka 'struct esp_tls'}
  219 |                 result->esp_tls_handle = calloc(1, sizeof(esp_tls_t));
      |                                                           ^~~~~~~~~
dhammuabhi commented 1 year ago

Yes I too came accross this issue. Can anyone help me to solve this issue?

Rainbow-Cai commented 1 year ago

Hi There are no the "esp_tls_conn_delete()" functions in the v5.0 IDF SDK. Please refer to the “Function Deprecations And Recommended Alternatives” programming guide. image

dhammuabhi commented 1 year ago

second issue still didn't resolve

/home/ubuntu22/esp/esp-azure/port/src/tlsio_esp_tls.c:220:59: error: invalid application of 'sizeof' to incomplete type 'esp_tls_t' {aka 'struct esp_tls'} 220 result->esp_tls_handle = calloc(1, sizeof(esp_tls_t));
someone42 commented 1 year ago

To anyone having this issue, the second error can be resolved by replacing the line: result->esp_tls_handle = calloc(1, sizeof(esp_tls_t)); with: result->esp_tls_handle = esp_tls_init();