platformio / platformio-core

Your Gateway to Embedded Software Development Excellence :alien:
https://platformio.org
Apache License 2.0
7.92k stars 792 forks source link

LDF doesn't resolve dependencies in (+) modes if an intermediate header file is located outside lib folders #4818

Open valeros opened 10 months ago

valeros commented 10 months ago

Description of problem

LDF (in any mode that evaluates C/C++ Preprocessor conditional syntax) is not able to find a dependency when a header from that dependency is hidden under an ifdef guard and the macro that enables the include header file is located outside search paths (framework libraries, include and src folders) passed to CCONDITIONAL_SCANNER,

For example the CONFIG_ETH_ENABLED macro in the code below is set in the sdkconfig.h file which is located in the framework folder $PIO_PACKAGES/framework-arduinoespressif32/tools/sdk/esp32/dio_qspi/include.

Steps to Reproduce

Compile the following code:

#include <Arduino.h>
#include <sdkconfig.h>

#ifdef CONFIG_ETH_ENABLED
#include "ETH.h"
#endif

void setup() {}

void loop() {}

with the following configuration:

[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev
lib_ldf_mode = deep+

Actual Results

Scanning dependencies...
No dependencies
Compiling .pio\build\esp32dev\src\main.cpp.o
src/main.cpp:25:10: fatal error: ETH.h: No such file or directory

Expected Results

Scanning dependencies...
Dependency Graph
|-- Ethernet @ 2.0.0
sklyarovaleksey commented 6 months ago

The same issue