How to properly configure platformio.ini to work with local libraries?

Good day, dear!

I apologize in advance for the English, as I translate through Google.

  1. When building my projects, I use a lot of my local libraries, which are located on disk “outside” the project directory. For example:
    Libraries Directory: C: \ PlatformIO \ libs
    Project directory: C: \ PlatformIO \ village_garage \

This is done in order to be able to use the same libraries in different projects.

  1. There are quite a lot of libraries, so they are distributed in several subfolders to simplify my work with them. For example:
    C: \ PlatformIO \ libs \ system
    C: \ PlatformIO \ libs \ peripherals
    C: \ PlatformIO \ libs \ sensors
    C: \ PlatformIO \ libs \ wifi
    C: \ PlatformIO \ libs \ clouds
    However, the compiler fundamentally disagrees with me :wink:

As long as all the libraries are in the root C: \ PlatformIO \ libs \ everything is fine. As soon as I pull libraries into subfolders, the library from one subfolder stops seeing the library from another subfolder.

C:/PlatformIO/libs/system/reStates/include/reStates.h:17:10: fatal error: reLed.h: No such file or directory

My platformio.ini file now looks like this:

; ---------------------------------------------------------------------------------------------
; General configuration
; ---------------------------------------------------------------------------------------------

[env]
; Build options
build_flags =
    ; Specifying where to look for project_config.h when building libraries
    -Iinclude

; COM Monitor Filters
monitor_filters =
    direct
    log2file
    ; esp32_exception_decoder

; -------------------------------------------------- -------------------------------------------
; Libraries
; -------------------------------------------------- -------------------------------------------

; Public libraries from the PlatformIO Library Directory or GitHub
lib_deps =

; Local Libraries
lib_extra_dirs =
  C: \ PlatformIO \ libs \ system
  C: \ PlatformIO \ libs \ peripherals
  C: \ PlatformIO \ libs \ sensors
  C: \ PlatformIO \ libs \ wifi
  C: \ PlatformIO \ libs \ clouds

; -------------------------------------------------- -------------------------------------------
; Sections
; -------------------------------------------------- -------------------------------------------

board_build.partitions = partitions.csv

; -------------------------------------------------- -------------------------------------------
; Include files
; -------------------------------------------------- -------------------------------------------

board_build.embed_txtfiles =
    ; DST Root CA X3 certificate (used as root for MQTT, OTA and other servers) is valid until September 30, 2021. 17:01:15
    C: \ PlatformIO \ libs \ certs \ dst_root_ca_x3.pem
    ; Telegram API certificate is valid until May 23, 2022. 19:17:38
    C: \ PlatformIO \ libs \ certs \ api_telegram_org.pem
    
; -------------------------------------------------- -------------------------------------------
; Controller configuration
; -------------------------------------------------- -------------------------------------------

[env: esp32dev]
platform = espressif32
board = esp32dev
framework = espidf
upload_speed = 921600
monitor_speed = 115200

QUESTION: How to properly configure platformio.ini to work with local libraries?

Fundamentally it’s the library dependency finder’s job to discover the libraries, the compiler messages are likely just the result of the LDF not finding a library dependency.

Have you tried increasing the LDF mode to e.g. lib_ldf_mode = chain+? Have you tried adding the reLed library explicitly into lib_deps?

If that doesn’t help we would need the exact libraries and minimal source code to reproduce the problem.

Thanks!!!
lib_ldf_mode = deep solved the problem

Adding to lib_deps … Hmm … But that will have to add each library there, and there are already 32 … Too troublesome.

If the LDF recognizes the library (dependency) then that’s not needed. Just a possible fallback / debugging step to force inclusion.