Skip to content

lib_ldf_mode = off fails to resolve symlinked dependencies on Windows (works on WSL) #5421

@sylque

Description

@sylque

Description:
When using lib_ldf_mode = off, PlatformIO fails to find some dependencies (specifically symlinked libraries) under Windows. To get it to compile, it frequently requires manually deleting the .pio/libdeps folder. However, using the exact same configuration and project under WSL compiles perfectly without needing to clear the cache.

(Note: This was originally opened by mistake in platform-espressif32 as issue #1690).

Steps to Reproduce:

  1. Create a project on Windows utilizing symlinked local libraries in lib_deps.
  2. Set lib_ldf_mode = off in platformio.ini.
  3. Build the project.

Expected Behavior:
The LDF should resolve the symlinked libraries and compile the project successfully, just as it does under WSL.

Actual Behavior:
Under Windows, the compilation sometimes fails because the symlinked libraries are not found by the compiler.

Windows Output (Fails):

LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ off, Compatibility ~ soft
Found 68 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ArduinoEigen @ 0.3.2
|-- OneButton @ 2.6.1
|-- Wire @ 3.3.4
|-- SPI @ 3.3.4
|-- Preferences @ 3.3.4
Building in debug mode
...
src/main.cpp:6:10: fatal error: syl/FreeRtosStats.h: No such file or directory

WSL Output (Succeeds):

LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ off, Compatibility ~ soft
Found 64 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ArduinoEigen @ 0.3.2
|-- OneButton @ 2.6.1
|-- PendulumComponents
|-- NetVarFsm
|-- ImuTools
|-- Wire @ 3.3.4
|-- SPI @ 3.3.4
|-- Preferences @ 3.3.4
...
================================= [SUCCESS] =================================

Workaround:

  • Deleting the libdeps folder is usually enough.
  • More rarely, it seems restarting VSCode is required.

platformio.ini Extract:

[platformio]
default_envs = debugNoBle
build_cache_dir = ${platformio.core_dir}/build_cache

[env]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.34/platform-espressif32.zip
board = esp32-s3-devkitc-1
framework = arduino
monitor_speed = 115200
upload_speed = 1500000
board_build.partitions = huge_app.csv
build_unflags = 
  -Os
  -Werror=all
  -std=gnu++2a -std=gnu++2b
  -fno-rtti
build_flags = 
  -std=gnu++23
  -I".pio/libdeps/${PIOENV}/Adafruit BusIO" ; Required for lib_ldf_mode = off
  -I"${platformio.packages_dir}/framework-arduinoespressif32/libraries/Wire/src" ; Required for lib_ldf_mode = off
  -I"${platformio.packages_dir}/framework-arduinoespressif32/libraries/SPI/src" ; Required for lib_ldf_mode = off
  -I"${platformio.packages_dir}/framework-arduinoespressif32/libraries/Preferences/src" ; Required for lib_ldf_mode = off
lib_deps =
  ArduinoEigen
  mathertel/OneButton
  symlink://../../PendulumComponents
  symlink://../../../AymLibs/NetVarFsm
  symlink://../../../AymLibs/ImuTools
  Wire ; Required for lib_ldf_mode = off
  SPI ; Required for lib_ldf_mode = off
  Preferences ; Required for lib_ldf_mode = off
lib_ldf_mode = off

Environment:

  • OS: Windows 11 (Fails) vs WSL (Works)
  • PlatformIO Core Version: 6.1.19

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions