How to fix ESP-IDF fatal error: esp_crt_bundle.h: No such file or directory

Problem

While compiling your ESP-IDF project, you get an error message like this:

/home/user/my-project/managed_components/espressif__rmaker_common/src/esp-mqtt/esp-mqtt-glue.c:47:10: fatal error: esp_crt_bundle.h: No such file or directory
   47 | #include <esp_crt_bundle.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.

Solution

Either make Rainermaker not use the certificate bundle, or enable the certificate bundle component in your project’s sdkconfig file.

In your project’s sdkconfig file, set the following:

CONFIG_ESP_RMAKER_USE_CERT_BUNDLE=n
CONFIG_ESP_RMAKER_MQTT_USE_CERT_BUNDLE=n

Enable the certificate bundle component

This eats up a bunch of flash space, so my recommendation is to only do this if you really need it.

Enable the certificate bundle component in your project’s sdkconfig file:

CONFIG_ESP_CRT_BUNDLE=y