espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.48k stars 7.26k forks source link

MQTT implementation error on mqtt_app_start() (IDFGH-10208) #11474

Closed fnandomaia closed 11 months ago

fnandomaia commented 1 year ago

Answers checklist.

IDF version.

esp-idf-v5.0.1

Operating System used.

Windows

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

CMD

Development Kit.

WT32-SC01 Plus 8Bit Parallel 3.5

Power Supply used.

USB

What is the expected behavior?

I'm trying to implement the MQTT protocol inside an ESP32-TUX instance.

  1. I enabled MQTT configuration inside idf.py menuconfig.

  2. main.hpp I put the include of the local file for the mqtt library downloaded from Github (https://github.com/espressif/esp-mqtt) because that way it didn't give error of include not found.

  3. main.hpp include mqtt_client.h file. I initialized the functions: mqtt_event_handler() and mqtt_app_start(). 001

  4. main.cpp I placed the respective functions from the previous step and initialized mqtt_app_start(). 002

What is the actual behavior?

It happens that when compiling it gives an error inside the mqtt_client.h library, as shown in the image below. 003

I wonder if anyone has an idea of where am I getting wrong with my code? Looks like some C# C++ error.

Steps to reproduce.

As describle above.

Debug Logs.

No response

More Information.

No response

euripedesrocha commented 1 year ago

Hi @fnandomaia, we introduced a new feature in the mqtt client that breaks the compilation for C++, with the usage of this convenience macro. This should be fixed soon.

euripedesrocha commented 1 year ago

Hi @fnandomaia taking a look again on your issue, while is there a problem on our side, I would also like to point that you may have issues on your project configuration. From the description of your usage of MQTT library, I think you are missing the mqtt component in your required dependencies. There is no need to clone the MQTT client separately as you are doing.

tshcherban commented 1 year ago

Hi any updates here? Im using IDF v 5.1 and a simple MQTT example, compiling with C++. Compiles ok but fails at runtime on calling esp_mqtt_client_init with an error:

Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x400556c0  PS      : 0x00060f30  A0      : 0x8005562d  A1      : 0x3fca7bb0
0x400556c0: strlen in ROM

The same example works OK under C language.

euripedesrocha commented 1 year ago

@tshcherban could you please open a new issue, providing the information to verify(Mqtt client configuration, sdkconfig, mqtt version) ? The build problem I mentioned is already solved and not present in 5.1.