Default #include path broken?

Hello,
I’m using platformio / vscodium only occasionally.
Compile & Link has been working in the past. But now it seems that the default include path is broken.

After opening an existing project I first cleaned it.

 *  Executing task in folder RainWaterControl.ESP32: platformio run --target clean 

Processing esp32doit-devkit-v1 (platform: espressif32; board: esp32doit-devkit-v1; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
Removing .pio/build/esp32doit-devkit-v1
Done cleaning

Then I tried to build

*  Executing task in folder RainWaterControl.ESP32: platformio run 

Processing esp32doit-devkit-v1 (platform: espressif32; board: esp32doit-devkit-v1; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32doit-devkit-v1.html
PLATFORM: Espressif 32 (6.4.0) > DOIT ESP32 DEVKIT V1
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.20011.230801 (2.0.11) 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 58 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ESPAsync_WiFiManager_Lite @ 1.10.5
|-- ESP Async WebServer @ 1.2.3+sha.8e9c5a6
|-- ESPAsyncDNSServer @ 1.0.0+sha.3c6627d
|-- AsyncMqttClient @ 0.9.0
|-- AsyncElegantOTA @ 2.2.8
|-- WiFi @ 2.0.0
Building in release mode
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/Esp.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/FirmwareMSC.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/FunctionalInterrupt.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/HWCDC.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/HardwareSerial.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/IPAddress.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/IPv6Address.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/MD5Builder.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/Print.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/Stream.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/StreamString.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/Tone.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/USB.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/USBCDC.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/USBMSC.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/WMath.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/WString.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/base64.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/cbuf.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-adc.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-bt.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-cpu.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-dac.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-gpio.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-i2c-slave.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-i2c.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-ledc.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-matrix.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-misc.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-psram.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-rgb-led.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-rmt.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-sigmadelta.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-spi.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-time.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-timer.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-tinyusb.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-touch.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/esp32-hal-uart.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/firmware_msc_fat.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/libb64/cdecode.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/libb64/cencode.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/main.cpp.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/stdlib_noniso.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/wiring_pulse.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/FrameworkArduino/wiring_shift.c.o' from cache
Retrieved `.pio/build/esp32doit-devkit-v1/libFrameworkArduino.a' from cache
Linking .pio/build/esp32doit-devkit-v1/firmware.elf
/data/PlatformIO/packages/toolchain-xtensa-esp32@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32doit-devkit-v1/src/asyncMQTT_onMessage.cpp.o: in function `onMqttMessage(char*, char*, AsyncMqttClientMessageProperties const&, unsigned int const&, unsigned int const&, unsigned int const&)':
/data/PlatformIO/Projects/RainWaterControl.ESP32/src/asyncMQTT_onMessage.cpp:12: multiple definition of `onMqttMessage(char*, char*, AsyncMqttClientMessageProperties const&, unsigned int const&, unsigned int const&, unsigned int const&)'; .pio/build/esp32doit-devkit-v1/src/asyncMQTT.cpp.o:/data/PlatformIO/Projects/BoilerPlate.ESP32/src/asyncMQTT.cpp:199: first defined here
collect2: error: ld returned 1 exit status
*** [.pio/build/esp32doit-devkit-v1/firmware.elf] Error 1

As you can see, that the Linker tries to combine files from my current project directory.

/data/PlatformIO/Projects/RainWaterControl.ESP32/src/asyncMQTT_onMessage.cpp

and another project directory

/data/PlatformIO/Projects/BoilerPlate.ESP32/src/asyncMQTT.cpp

I did not understand why this is happening. The default include path is just to include everything below project directory.

Found include_dir in Platformio docs, but this is only about adding dirs.
And there is no include directive in my platformio.ini

please enlighten me

Ok,
it seems that some compile information is stored in a user cache directory.

/home/user/.cache/build ...

Some other informaton is stored in the project specific directory’s

/data/PlatformIO/Projects/project1/.pio/build/...
/data/PlatformIO/Projects/project2/.pio/build/...

When building project1 information (the object file?) is stored in the user directory. When building project2 the system checks if there is a correspondig info in the user directory. If yes it is retrieved and used. The source of project2 is not compiled! And thats wrong if there are files with same function names!

How to force that the cache is project specific only?
And how to do this as a global setting?

If you found a bug, please post to https://github.com/platformio/platformio-core/issues with a minimal project / instructions on how to reproduce your setup, code and platformio.ini included.