Correct way of bypassing LDF

When I build my firmware either in WSL or in a docker container, it takes about 2 minutes for the LDF to run, I’m assuming due to the Windows hypervisor overhead.

Because of this (and just because it’s a slow process), I would like to disable the LDF but I’m unsure of how to provide the new dependencies.

I have dumped the dependencies found by the LDF via

Import("env")
print(env.Dump())

and now I’m trying to add them manually like so:

...
lib_ldf_mode = off
lib_deps =
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/AsyncUDP
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/WiFi
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/WiFiClientSecure
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/HTTPClient
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/HTTPUpdate
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/HTTPUpdateServer
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/ArduinoOTA
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/AzureIoT
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/BLE
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/BluetoothSerial
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/DNSServer
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/EEPROM
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/ESP32
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/ESPmDNS
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/FFat
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/FS
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/NetBIOS
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/Preferences
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/SD
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/SD_MMC
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/SPI
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/SPIFFS
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/SimpleBLE
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/Ticker
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/Update
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/WebServer
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/WiFiProv
  ${platformio.packages_dir}/framework-arduinoespressif32/libraries/Wire
  ${extra.lib_deps_base}
  etlcpp/Embedded Template Library @ ^19.3.5
  ./lib/ControllablePowerOutputs/ControllablePowerOutputBase
  ./lib/ControllablePowerOutputs/PowerOutput_24V
  ./lib/ControllablePowerOutputs/PowerOutput_5V
...

This doesn’t work though because I end up with issues where it doesn’t find the correct header anyway. It also ends up that all of these depedencies are copied into .pio rather than just being seen as includes. The other alternative to do it is via build flags but I feel like SCons/platformio should have a native way to do it correctly.

Probably because libraries internally depend on each other but with the LDF off those dependency libs are not getting included in the build environment for that lib.

With PIO Core 6.x (pio uprade --dev) you can add symlink:// in front of each library, then it will not do a copy.

Which is a lot more than on Windows or Linux native? With which lib_ldf_mode originally?

(deep is slow unless overhauled internally.)

Thanks for getting back to me.

But then how is the way to add the dependency manually? Through -I? And then make sure that the linker gets everything?

Yep, I mean it takes maybe 10 seconds normally which is still more than I would like but at least it’s not 2 minutes. Current mode is left at default (chain)

Building in WSL or a docker container means I can standardise my unit testing and not have to mess around with Mingw

Here’s where it gets complicated, that might work yes but in some special cases not because if a library dependency is not detected, the special settings contained in the library’s library.json (such as build flags or special generation logic etc.) will not be executed. I’m not sure exactly. If you have a specific (more minimal) project you can also post it as an issue at Issues · platformio/platformio-core · GitHub and ask how to do that with the LDF off but still compiling successfully.

Oh wow that’s a lot. Are you sure that’s not because some Antivirus software is snooping every binary run inside there?

Yeah, I have asked in an issue related to the build duration on Github but haven’t gotten a response on it yet.

I’m not really using any external dependencies with a library.json besides the built in framework libraries so there shouldn’t really be any custom building

Oh wow that’s a lot. Are you sure that’s not because some Antivirus software is snooping every binary run inside there?

I have Windows Security exclusions set on the project folder, the platformio executable and on the ~/.platformio folder so I don’t think there should be any problems