Page 1 of 1

Compilation errors when including mbedtls/esp_debug.h

Posted: Wed Mar 20, 2019 1:54 pm
by michelesolytic
Hello everyone!

I'm using ESP-IDF 3.1.3 and I'm encountering recurrent crashes during TLS connections. I thus decided to turn on CONFIG_MBEDTLS_DEBUG into "make menuconfig" and to include "mbedtls/esp_debug.h" into the main header file of my project (written in c++).
While compiling however I encounter the following error:

Code: Select all

/home/michele/git/esp-idf/components/mbedtls/port/include/mbedtls/esp_debug.h:43:35: error: variable or field 'mbedtls_esp_enable_debug_log' declared void
 void mbedtls_esp_enable_debug_log(mbedtls_ssl_config *conf, int threshold);
                                   ^
/home/michele/git/esp-idf/components/mbedtls/port/include/mbedtls/esp_debug.h:43:35: error: 'mbedtls_ssl_config' was not declared in this scope
/home/michele/git/esp-idf/components/mbedtls/port/include/mbedtls/esp_debug.h:43:55: error: 'conf' was not declared in this scope
 void mbedtls_esp_enable_debug_log(mbedtls_ssl_config *conf, int threshold);
                                                       ^
/home/michele/git/esp-idf/components/mbedtls/port/include/mbedtls/esp_debug.h:43:61: error: expected primary-expression before 'int'
 void mbedtls_esp_enable_debug_log(mbedtls_ssl_config *conf, int threshold);
Many others follow, but basically the problem lies in the fact there are missing declarations (which seems to be present in /mbedtls/mbedtls/include/mbedtls/ssl.h)

Is there something I am missing? The information in the menuconfig entry do not tell me much more.
Thanks to everyone who can help me sort this out :)

Re: Compilation errors when including mbedtls/esp_debug.h

Posted: Wed Mar 20, 2019 10:33 pm
by ESP_Angus
Hi michele,

This looks like a bug that esp_debug.h doesn't correctly include all its own dependencies.

Where you include it in your main project file, do so like this:

Code: Select all

include "mbedtls/ssl.h"
include "mbedtls/esp_debug.h"
Will fix ASAP.

Angus