PlatformIO Community

"FS.h: No such file or directory" with ldf_mode deep+

Hello,

I’m not able to build my project when using the deep+ ldf_mode and #include <SD_MMC.h>
I get the following error :

In file included from C:/Users/mgarnier/.platformio/packages/framework-arduinoespressif32/libraries/SD_MMC/src/SD_MMC.cpp:16:
C:/Users/mgarnier/.platformio/packages/framework-arduinoespressif32/libraries/SD_MMC/src/SD_MMC.h:21:10: fatal error: FS.h: No such file or directory

I’m using the last up to date version of platformio, arduino framework and board esp32dev
You can reproduce the error by creating a new project, setting the ldf mode to deep+, and including SD_MMC.h.

main.cpp

#include <Arduino.h>
#include <SD_MMC.h>

void setup()
{
  // put your setup code here, to run once:
}

void loop()
{
  // put your main code here, to run repeatedly:
}

platformio.ini

[env:featheresp32]
platform = espressif32
board = featheresp32
lib_ldf_mode = chain+
framework = arduino

It works normally when using chain or deep modes, but not with chain+ or deep+

I’m a bit lost with this error and I really need the deep+ mode

Any help is appreciated
Thanks !

You’re right indeed. With lib_ldf_mode = chain+ or deep+, the dependency of SD_MMC to the FS library is not detected and the build fails.

Dependency Graph
|-- SD_MMC @ 2.0.0

However, with no lib_ldf_mode set, or set to deep or chain, it succeeds.

Dependency Graph
|-- SD_MMC @ 2.0.0
|   |-- FS @ 2.0.0
Building in release mode
[...]
RAM:   [          ]   4.9% (used 16144 bytes from 327680 bytes)
Flash: [==        ]  16.2% (used 212977 bytes from 1310720 bytes)

So, although deep+ and chain+ should evaluate the #ifdef macros, in the SD_MMC.h file does

PlatformIO doesn’t seem to think that SOC_SDMMC_HOST_SUPPORTED is enabled, although it is set so in the soc/soc_caps.h file included previously.

I will open a bug report about this.

A workaround is adding

build_flags = -DSOC_SDMMC_HOST_SUPPORTED

to the platformio.ini, then deep+ mode can be used.

This is now tracked in LDF doesn't evaluate macro properly · Issue #4414 · platformio/platformio-core · GitHub.

Nice !
Your workaround is working fine, thank you for your help !