Azure / azure-sdk-for-c

This repository is for active development of the Azure SDK for Embedded C. For consumers of the SDK we recommend visiting our versioned developer docs at https://azure.github.io/azure-sdk-for-c.
MIT License
218 stars 115 forks source link

Azure_SDK_for_C ESP32 on Arduino IDE Compile Errors {Compilation error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'uri'} #2836

Closed daveRobert1441 closed 3 weeks ago

daveRobert1441 commented 1 month ago

Query/Question Having the following errors at compile, had it working fine before but now these errors appear. The struct traces back to the 'mqtt_client.h'. Nothing was changed in the original library .files

Why is this not a Bug or a feature Request? May be part of a library structure problem

Setup (please complete the following information if applicable):

Compile Error: ““\Documents\Arduino\libraries\Azure_SDK_for_C\examples\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino: In function 'int mqtt_client_init_function(mqtt_client_config_t*, void**)':

““\Documents\Arduino\libraries\Azure_SDK_for_C\examples\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:131:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'uri'

131 | mqtt_config.uri = mqtt_broker_uri;

  |               ^~~

““\Documents\Arduino\libraries\Azure_SDK_for_C\examples\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:132:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'port'

132 | mqtt_config.port = mqtt_client_config->port;

  |               ^~~~

““\Documents\Arduino\libraries\Azure_SDK_for_C\examples\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:133:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'client_id'

133 | mqtt_config.client_id = (const char*)az_span_ptr(mqtt_client_config->client_id);

  |               ^~~~~~~~~

““\Documents\Arduino\libraries\Azure_SDK_for_C\examples\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:134:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'username'

134 | mqtt_config.username = (const char*)az_span_ptr(mqtt_client_config->username);

  |               ^~~~~~~~

““\Documents\Arduino\libraries\Azure_SDK_for_C\examples\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:141:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'password'

141 | mqtt_config.password = (const char*)az_span_ptr(mqtt_client_config->password);

  |               ^~~~~~~~

““\Documents\Arduino\libraries\Azure_SDK_for_C\examples\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:144:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'keepalive'

144 | mqtt_config.keepalive = 30;

  |               ^~~~~~~~~

““\Documents\Arduino\libraries\Azure_SDK_for_C\examples\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:145:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'disable_clean_session'

145 | mqtt_config.disable_clean_session = 0;

  |               ^~~~~~~~~~~~~~~~~~~~~

““\Documents\Arduino\libraries\Azure_SDK_for_C\examples\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:146:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'disable_auto_reconnect'

146 | mqtt_config.disable_auto_reconnect = false;

  |               ^~~~~~~~~~~~~~~~~~~~~~

““\Documents\Arduino\libraries\Azure_SDK_for_C\examples\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:147:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'event_handle'

147 | mqtt_config.event_handle = esp_mqtt_event_handler;

  |               ^~~~~~~~~~~~

““\Documents\Arduino\libraries\Azure_SDK_for_C\examples\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:148:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'user_context'

148 | mqtt_config.user_context = NULL;

  |               ^~~~~~~~~~~~

““\Documents\Arduino\libraries\Azure_SDK_for_C\examples\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:149:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'cert_pem'

149 | mqtt_config.cert_pem = (const char*)ca_pem;

  |               ^~~~~~~~

exit status 1

Compilation error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'uri'

vaavva commented 1 month ago

@daveRobert1441 What version of the ESP32 board library are you using? Our samples are tested against version 2.0.9 (https://github.com/Azure/azure-sdk-for-c-arduino/blob/main/examples/Azure_IoT_Central_ESP32/readme.md?plain=1#L24).

daveRobert1441 commented 1 month ago

Hi vaavva, I'm using Arduino IDE 2.3.2 and the latest espressif/arduino-esp32 which looks like v3.0.0.

edit: I found the old version 2.0.9 (git checkout 3670e2b). I tried this and the compile errors did not change. Corrected above typo.

duyle1402 commented 1 month ago

I had the same problem when updating to ESP32 Arduino core 3.0.0. Everything I tested worked well with ESP32 Arduino core version 2.0.x. However, after updating to Arduino ESP32 3.0.0 last week, I can no longer compile my code. I believe the issue is due to breaking changes in Arduino core 3.0.0 base on ESP-IDF v5.1.4.

OS: Window 11

Azure SDK version: 1.1.6

Esp32 Arduino Core: 3.0.0

daveRobert1441 commented 3 weeks ago

I did a new install of Arduino (2.3.2) on Windows 11, added the Azure SDK for C library, added the ESP32 Dev Module board (v3.0.1). No changes to the Azur_IoT_Central_ESP32 example and had the same compile errors.

How would I acquire an older version of the ESP32 board libraries?

ewertons commented 3 weeks ago

Hi @daveRobert1441 , a fix has been merged for the Azure SDK for C arduino library to work with 3xx ESP32 board lib. Arduino Library Manager should be updated in a day or two.

ewertons commented 3 weeks ago

Fixed and published to library manager.