PlatformIO Community

[SOLVED] No Such File or Directory : x509_crt_bundle

I have been playing around with Platform IO for a bit now and have had it mostly working well. But recently I have run into an error that has me stumped. I am just using the simple example ESP IDF Hello World project in Platform IO. I used the automated feature to create the project from Home Screen. At build time, I get an initial error that states

Generating assembly for certificate bundle...
CMake Error at /Users/sriraj/.platformio/packages/framework-espidf/tools/cmake/scripts/data_file_embed_asm.cmake:26 (file):
  file failed to open for reading (No such file or directory):


*** Error 1

Then it proceeds to build everything else before giving a fatal error -

*** [.pio/build/esp32dev/.pio/build/esp32dev/x509_crt_bundle.o] Source .pio/build/esp32dev/x509_crt_bundle.S' not found, needed by target .pio/build/esp32dev/.pio/build/esp32dev/x509_crt_bundle.o'.

Please note the following:

  1. I got out of Platform IO - used the regular ESP IDF framework and was able to compile the same program without any issues.
  2. I ran menuconfig and disabled mbedTLS root certificate bundle and it did nothing
  3. I uninstalled and reinstalled both ESP IDF framework and Platform IO - no luck

If I create a Platform IO ESP - Arduino example project (Blink) - it compiles and runs. If I run a similar hello world program using plain vanilla ESP-IDF it works.
I am stumped! Please help… thanks in advance

Does the output also say:

Invalid certificate

If so, it’s the same issue as this one:

No - it does not state Invalid certificate. The error seems to be an absent x509_crt_bundle file in the build directory of my current project. I assume the certificate bundle is generated a build time - perhaps this is failing for some reason.

Generating assembly for certificate bundle...
CMake Error at /Users/sriraj/.platformio/packages/framework-espidf/tools/cmake/scripts/data_file_embed_asm.cmake:26 (file):
  file failed to open for reading (No such file or directory):


The problem arises because Platform IO build process generates a x509 certificate bundle file at compile time. Further, the error thrown by the python script generating the bundle is not displayed as part of project error - all we get is that the final certificate bundle is missing.

  1. Navigate to ~/.platformio/packages/framework-espidf/components/mbedtls/esp_crt_bundle/ directory
  2. Check to ensure you have cacrt_all.pem file there, if not download root certificate bundle file from Mozilla
  3. Run python3 -i cacrt_all.pem - if you get an error in this step, your root certificate bundle file is corrupt - this error is hidden during project build. Open the PEM file and delete the certificate under EC-ACC, save and re-run
  4. You should see a message like below Parsing certificates from cacrt_all.pem Successfully added 134 certificates Successfully added 134 certificates in total
  5. Now go and build project