Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LDF downloads always all "lib" dependencies regardless of lib_deps #4823

Open
BlueAndi opened this issue Jan 6, 2024 · 15 comments
Open

LDF downloads always all "lib" dependencies regardless of lib_deps #4823

BlueAndi opened this issue Jan 6, 2024 · 15 comments
Labels

Comments

@BlueAndi
Copy link

BlueAndi commented Jan 6, 2024

Configuration

Operating system:
Win10 + VSCode + PIO

PlatformIO Version (platformio --version):
6.1.11

Description of problem

The platformio.ini contains several environments. Every environment requires a different set of libraries, which are configured by lib_deps. The problem is that ALL dependencies are downloaded for every environment, means .pio/libdeps/<ENV> contains always all of them.

Steps to Reproduce

platformio.ini

[env:testA]
board = esp32doit-devkit-v1
board_build.filesystem = littlefs
platform = espressif32 @ ~6.5.0
framework = arduino
lib_deps =
    A

[env:testB]
board = esp32doit-devkit-v1
board_build.filesystem = littlefs
platform = espressif32 @ ~6.5.0
framework = arduino
lib_deps =
    B

lib/A/library.json

{
    "name": "A",
    "dependencies": [{
        "owner": "makuna",
        "name": "NeoPixelBus",
        "version": "~2.7.3"
    }]
}

lib/B/library.json

{
    "name": "B",
    "dependencies": [{
        "owner": "bodmer",
        "name": "TFT_eSPI",
        "version": "~2.5.31"
    }]
}

Actual Results

.pio/libdeps/testA/ folder contains NeoPixelBus and TFT_eSPI libraries
.pio/libdeps/testB/ folder contains NeoPixelBus and TFT_eSPI libraries

Expected Results

.pio/libdeps/testA/ folder contains ONLY NeoPixelBus library
.pio/libdeps/testB/ folder contains ONLY TFT_eSPI library

Notes

It seems LDF loops over every library in ./lib instead of following environment wise.

@ivankravets
Copy link
Member

Do you run only the specified environment? pio run -e testB

@BlueAndi
Copy link
Author

BlueAndi commented Jan 9, 2024

The environments are exclusively used, depended on the use case. Not sure whether I understood your question right. :-)

@ivankravets ivankravets added this to the 6.1.14 milestone Feb 8, 2024
@ivankravets
Copy link
Member

Please provide a simple project (as ZIP attached to this issue) to reproduce this issue.

@BlueAndi
Copy link
Author

BlueAndi commented Feb 8, 2024

pioLibTest.zip

@ivankravets
Copy link
Member

I can't reproduce this issue:

$ pio run  -e testA

Processing testA (board: esp32doit-devkit-v1; platform: espressif32; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Library Manager: Installing makuna/NeoPixelBus @ ~2.7.3
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Library Manager: [email protected] has been installed!
Library Manager: Installing bodmer/TFT_eSPI @ ~2.5.31
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Library Manager: [email protected] has been installed!
Verbose mode can be enabled via `-v, --verbose` option
....


Screenshot 2024-02-09 at 12 05 32

@gabryelreyes
Copy link

I believe you did reproduce the issue. lib/A/library.json contains ONLY NeoPixelBus as a dependency, however in the libdeps folder you have TFT_eSPI too. This is what the issue describes on the first comment.

@ivankravets
Copy link
Member

Does NeoPixelBus depend on TFT_eSPI?

@gabryelreyes
Copy link

No, it does not.

@ivankravets ivankravets reopened this Feb 9, 2024
@ivankravets
Copy link
Member

Thanks, we reproduced this issue. This is a normal behaviour, see https://github.com/platformio/platformio-core/blob/develop/platformio/package/commands/install.py#L258

We resolve dependencies BEFORE LDF starts (because we need all manifests). Please note that libraries installed/copied to the libdeps folder are not always built (LDF decides). Also, external libraries from the registry are cached locally, there is not "redownloading" that could lead to additional compilation time.

@gabryelreyes
Copy link

Can you please test the following project?

pioLibTest2.zip

Library "A" depends on ArduinoJson @ ~6.16.1 but instead it gets compiled with ArduinoJson @ ~7.0.3, which is a dependency of "B".

Scanning dependencies...
Dependency Graph
|-- A
|-- ArduinoJson @ 7.0.3

@ivankravets ivankravets removed this from the 6.1.14 milestone Feb 9, 2024
@ivankravets
Copy link
Member

This is a bug. Could I ask you to file a new issue https://github.com/platformio/platformio-core ?

@gabryelreyes
Copy link

Sure, I can file a new issue. However, is this issue not already the description of the problem? The reason of this behavior is still the LDF loading all libraries.

If this issue is not enough, please detail what the new issue should say and contain in order to be different from this one.

Thank you for your support

@ivankravets
Copy link
Member

This issue relates to "all dependencies are downloaded from the "lib" folder" and this is normal behavior.

Library "A" depends on ArduinoJson @ ~6.16.1 but instead it gets compiled with ArduinoJson @ ~7.0.3, which is a dependency of "B".

This a bug. Please open a new issue and refer to this issue. Thank you so much for your attention and participation.

@BlueAndi
Copy link
Author

@ivankravets If always all dependencies from the lib folder are downloaded, its an performance issue for projects with a large number of environments, using always only a part of the libs. To get around, the only chance is to move the meta dependencies info from the libs to the environment directly, or do you recommend something else?

@ivankravets ivankravets added ldf Library Dependency Finder and removed help wanted wontfix labels Feb 12, 2024
@ivankravets ivankravets changed the title [Bug][6.1.11] LDF downloads always all dependencies regardless of lib_deps [Bug][6.1.11] LDF downloads always all "lib" dependencies regardless of lib_deps Feb 12, 2024
@ivankravets
Copy link
Member

I reopen this issue with updated subject. Indeed, we can improve PlatformIO Core behaviour installing local "lib" dependencies to the separate common folder.

Anyway, please file a new issue which actually a bug regarding LDF that picks wrong library version when requirements are declared and multiple versions of the same library are installed.

@ivankravets ivankravets reopened this Feb 12, 2024
@ivankravets ivankravets changed the title [Bug][6.1.11] LDF downloads always all "lib" dependencies regardless of lib_deps LDF downloads always all "lib" dependencies regardless of lib_deps Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants