Local library include file not found?

I have a platformio project that compiles and works. I decided to refactor and move to files logger.h and logger.cpp from an existing library directory lib/misc to a new library directory lib/logger. When I try to build, platformio detects the dependency on the new library lib/logger but #include “logger.h”, which previously used to work, fails. More information below.

Any idea what the problem may be?

Error message:

 #include <logger.h>
          ^~~~~~~~~~
compilation terminated.
In file included from lib\io\serial.h:6:0,
                 from lib\io\serial.cpp:1:
lib\misc/common.h:9:10: fatal error: logger.h: No such file or directory

platformio.ini (it contains a few library related directives such as lib_ldf_mode):

[env:my_env]
platform = ststm32
; test_filter = serial_packets/test_serial_packets_client
; debug_test = serial_packets/test_serial_packets_client
extra_scripts = extra_script.py
board = my_genericSTM32H750VBT6
; Linker file is from cube ide.
board_build.ldscript = STM32H750VBTX_FLASH.ld
debug_tool = stlink
upload_protocol = stlink
debug_build_flags = -Os -g3 -ggdb3
; debug_init_break = tbreak app_main
debug_init_break = tbreak none
test_framework = unity
test_port = COM6
monitor_port = COM6
lib_archive = no
check_skip_packages = yes
lib_ldf_mode=deep
# cube_ide is automatically populated by cube_ide/update_platformil.py
# startup contains the processor startup code and is based on 
# cube_ide/core/src/main.c. The rest of the libraries are detected
# automatically.
lib_deps = 
  cube_ide
  startup
build_flags =
  -fmax-errors=5
  -Werror
  -mfpu=fpv5-sp-d16 
  -mfloat-abi=hard 
  -Wl,-Map,${BUILD_DIR}/firmware.map
  -mthumb 
  -D DEBUG
  -D USE_HAL_DRIVER
  -DSTM32_THREAD_SAFE_STRATEGY=4
  -fstack-usage
  -std=gnu11
  -Ilib/cube_ide/Core/Inc
  -Ilib/cube_ide/Core/ThreadSafe
  -Ilib/cube_ide/Drivers/CMSIS/Device/ST/STM32H7xx/Include
  -Ilib/cube_ide/Drivers/CMSIS/Include
  -Ilib/cube_ide/Drivers/STM32H7xx_HAL_Driver/Inc
  -Ilib/cube_ide/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc
  -Ilib/cube_ide/Middlewares/ST/STM32_USB_Device_Library/Core/Inc
  -Ilib/cube_ide/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS
  -Ilib/cube_ide/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/Include
  -Ilib/cube_ide/Middlewares/Third_Party/FreeRTOS/Source/include
  -Ilib/cube_ide/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F
  -Ilib/cube_ide/Middlewares/Third_Party/FatFs/src
  -Ilib/cube_ide/USB_DEVICE/App
  -Ilib/cube_ide/USB_DEVICE/Target
  -Ilib/cube_ide/FATFS/App
  -Ilib/cube_ide/FATFS/Target
  -D CONFIG_MAX_PACKET_DATA_LEN=1000
  -D CONFIG_MAX_PENDING_COMMANDS=5

Build log (I do see ‘-Ilib\logger’ in the gcc command line):
$ pio run -vvvProcessing my_env (platform: ststm32; extra_scripts: extra_scrip - Pastebin.com (long)

The directory tree of my project:

+---.pio
|   +---build
|   |   \---my_env
|   |       +---lib2be
|   |       |   \---misc
|   |       +---lib3f1
|   |       |   \---startup
|   |       +---lib48e
|   |       |   \---host_link
|   |       +---lib4fd
|   |       |   \---controller
|   |       +---lib50d
|   |       |   \---io
|   |       +---lib7e9
|   |       |   \---logger
|   |       +---libd5d
|   |       |   \---data_recorder
|   |       +---libe47
|   |       |   \---cube_ide
|   |       |       +---Core
|   |       |       |   +---Src
|   |       |       |   +---Startup
|   |       |       |   \---ThreadSafe
|   |       |       +---Drivers
|   |       |       |   \---STM32H7xx_HAL_Driver
|   |       |       |       \---Src
|   |       |       +---FATFS
|   |       |       |   +---App
|   |       |       |   \---Target
|   |       |       +---Middlewares
|   |       |       |   +---ST
|   |       |       |   |   \---STM32_USB_Device_Library
|   |       |       |   |       +---Class
|   |       |       |   |       |   \---CDC
|   |       |       |   |       |       \---Src
|   |       |       |   |       \---Core
|   |       |       |   |           \---Src
|   |       |       |   \---Third_Party
|   |       |       |       +---FatFs
|   |       |       |       |   \---src
|   |       |       |       |       \---option
|   |       |       |       \---FreeRTOS
|   |       |       |           \---Source
|   |       |       |               +---CMSIS_RTOS
|   |       |       |               \---portable
|   |       |       |                   \---GCC
|   |       |       |                       \---ARM_CM4F
|   |       |       \---USB_DEVICE
|   |       |           +---App
|   |       |           \---Target
|   |       \---libee8
|   |           \---serial_packets
|   \---libdeps
|       \---my_env
+---.vscode
+---boards
+---lib
|   +---adc
|   +---controller
|   +---cube_ide
|   |   +---Core
|   |   |   +---Inc
|   |   |   +---Src
|   |   |   +---Startup
|   |   |   \---ThreadSafe
|   |   +---Drivers
|   |   |   +---CMSIS
|   |   |   |   +---Device
|   |   |   |   |   \---ST
|   |   |   |   |       \---STM32H7xx
|   |   |   |   |           +---Include
|   |   |   |   |           \---Source
|   |   |   |   |               \---Templates
|   |   |   |   \---Include
|   |   |   \---STM32H7xx_HAL_Driver
|   |   |       +---Inc
|   |   |       |   \---Legacy
|   |   |       \---Src
|   |   +---FATFS
|   |   |   +---App
|   |   |   \---Target
|   |   +---Middlewares
|   |   |   +---ST
|   |   |   |   \---STM32_USB_Device_Library
|   |   |   |       +---Class
|   |   |   |       |   \---CDC
|   |   |   |       |       +---Inc
|   |   |   |       |       \---Src
|   |   |   |       \---Core
|   |   |   |           +---Inc
|   |   |   |           \---Src
|   |   |   \---Third_Party
|   |   |       +---FatFs
|   |   |       |   \---src
|   |   |       |       \---option
|   |   |       \---FreeRTOS
|   |   |           \---Source
|   |   |               +---CMSIS_RTOS
|   |   |               +---include
|   |   |               \---portable
|   |   |                   \---GCC
|   |   |                       \---ARM_CM4F
|   |   \---USB_DEVICE
|   |       +---App
|   |       \---Target
|   +---data_recorder
|   +---host_link
|   +---io
|   +---logger
|   +---misc
|   +---printer_link
|   +---rtos_util
|   +---serial_packets
|   \---startup
+---src
+---test
|   +---misc
|   |   +---test_static_string
|   |   \---test_time_util
|   +---sd
|   |   \---test_rw
|   +---serial_packets
|   |   +---test_serial_packets_client
|   |   +---test_serial_packets_crc
|   |   +---test_serial_packets_data
|   |   +---test_serial_packets_decoder
|   |   \---test_serial_packets_encoder
|   +---test_sample
|   +---test_trivial
|   \---__pycache__
\---tools

So this goes via 3 libraries? lib/io depends on lib/misc depends on lib/logger? Does PlatformIO detect this chain correctly? Maybe try lib_ldf_mode = deep+ or chain / chain+

Thanks @maxgerhardt. I changed to deep+ and it works now.

It puzzles me because platformio did detect the new lib ‘lib/logger’ and listed in in the dependency list and the gcc command line, but for some reason lib/logger/logger.h was not found by the compiler.

Anyway, my project is in a very good shape now, including the unit test build/run. Thanks.

… For the record, chain+ and deep+ do work, while chain and deep do not. According to the documentation, the ‘+’ just helps with conditional includes but I don’t think I have them, at least not in my own code. I wonder if there are other differences.