What is the correct way to override a builtin library

platformio.ini:

[env:teensy41]
platform = teensy
board = teensy41
framework = arduino
lib_deps =
    symlink://C:/Etc/Dev/Arduino/libraries/LittleFS

The problem is that I need to use the local copy of LittleFS at C:\Etc\Dev\Arduino\libraries since the FRAM chip I’m using to back the LittleFS filesystem isn’t supported in the built-in version of the library. Output from pio run -v is as follows:

Library Manager: Installing symlink://C:/Etc/Dev/Arduino/libraries/LittleFS
Library Manager: LittleFS@1.0.1 has been installed!
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy41.html
PLATFORM: Teensy (4.18.0) > Teensy 4.1
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 7.75MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
 - framework-arduinoteensy @ 1.158.0 (1.58)
 - tool-teensy @ 1.158.0 (1.58)
 - toolchain-gccarmnoneeabi-teensy @ 1.110301.0 (11.3.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 96 compatible libraries
Scanning dependencies...
Dependency Graph
|-- LittleFS @ 1.0.0 (License: Unknown, Path: C:\Users\David\.platformio\packages\framework-arduinoteensy\libraries\LittleFS)
|   |-- SPI @ 1.0 (License: Unknown, Path: C:\Users\David\.platformio\packages\framework-arduinoteensy\libraries\SPI)
|-- OctoWS2811 @ 1.5 (License: Unknown, Path: C:\Users\David\.platformio\packages\framework-arduinoteensy\libraries\OctoWS2811)

Building in release mode
...

As can be seen, it has installed LittleFS from the local copy, but then when searching library dependencies, it’s still using the builtin one V 1.0.0.

How can I get pio run to explicitly use V1.0.1 of the library, so it’ll use the local copy that has support for the 4 Mb FRAM?

lib_deps =
    LittleFS=symlink://C:/Etc/Dev/Arduino/libraries/LittleFS

Does not work. Platformio.ini:

...
lib_deps =
    LittleFS=symlink://C:/Etc/Dev/Arduino/libraries/LittleFS

pio run -v output:

...
Scanning dependencies...
Dependency Graph
|-- LittleFS @ 1.0.0 (License: Unknown, Path: C:\Users\David\.platformio\packages\framework-arduinoteensy\libraries\LittleFS)
|   |-- SPI @ 1.0 (License: Unknown, Path: C:\Users\David\.platformio\packages\framework-arduinoteensy\libraries\SPI)
...

As can be seen, even with your change in place it’s still using the builtin one.

Even going so far as to explicitly call out the version:

...
lib_deps =
    LittleFS=symlink://C:/Etc/Dev/Arduino/libraries/LittleFS @ 1.0.1

does not solve the problem.

— Later —

I think I found the bug. Per the instructions here:

Creating Library — PlatformIO latest documentation

I created a library.json in the local copy, on the basis of the word “recommend” in the “Manifest” section of that page. It should be noted that for another library I created locally that isn’t in the repository, I found that use of a library.json was mandatory to get the library recognised. Thus when I found that the LittleFS library I installed and modified didn’t have one, I created a library.json file.for it.

Belierve it or not removing the library.json file solved the problem. I did note the existence of a library.properties file, but since that’s not even mentioned on the page I cited above, I figured that platformio would ignore it.

It appears that not only does platformIO not ignore library.properties but also if both library.json and library.properties are present, it causes the LDF to ignore the library. If this is intended behaviour, it should be explicitly called out on the “Crearting a Library” page, If it’s not, then there is a bug that should be fixed.

– Edit –

Just to provide full infomation, it should be noted that I specified the version as 1.0.1 in library.json and I also modified library.properties to have the same version number.