How to avoid compiling LittleFS runners

I try to compile LittleFS for ESP32. There’s a LittleFS version bundled with ESP-IDF, but it only supports the program flash while I use a secondary external flash, so I figure I need to install LittleFS separately.

lib_deps =
GitHub - littlefs-project/littlefs: A little fail-safe filesystem designed for microcontrollers

But compilation fails with
.pio/libdeps/skh3/littlefs/runners/bench_runner.c:22:10: fatal error: execinfo.h: No such file or directory
#include <execinfo.h>
^~~~~~~~~~~~
compilation terminated.

‘runners’ seems to be test code so I don’t want to compile it at all. Can I exclude this dir through build_src_filter? Or can I control the compilation of the library some other way without copying the repo source files to my project?

You’ll have to fork the repo and put a library.json file in the root of the repo that tells PlatformIO how to build the library. Most importantly, you need to set "srcDir": "." and a “srcFilter” to only build lfs.c and lfs_util.c.

Another option is to not care about it and only copy over the needed files. For example, in your project, just create lib/littlefs and in that folder, copy over lfs.{c, h} and lfs_util.{c,h}. Those should be all needed files.

1 Like

That took me literally just a minute to fix.
Maxgerhardt, I really appreciate all the help you continuously offer on this forum!