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 might skip or replace internal Arduino's libs when doing recursive resolution dependency graph #4940

Open
1 task done
vortigont opened this issue Jun 21, 2024 · 0 comments
Labels
help wanted ldf Library Dependency Finder

Comments

@vortigont
Copy link

vortigont commented Jun 21, 2024

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

Configuration

Operating system:
Ubuntu Linux

PlatformIO Version (platformio --version):
PlatformIO Core 6.1.15
platform: espressif32

Description of problem

It looks like LDF in sometimes could exclude bundled platform libraries from the dependency graph in situations like:

  • a 3rd party lib A depends on some bundled Arduino library, i.e. Wifi.h or FS.h
  • this lib's library manifest does NOT have those bundled libs defined in section "dependencies": []
  • another 3rd party lib B depends on lib A and has it defined in lib's manifest
  • user's project depends on a lib B and defines it's dependency in platformio.ini

During dependency graph LDF misses the dependency for lib A on bundled Arduino libs and when compiling lib A it fails with error like fatal error: Update.h: No such file or directory where Update.h is bundled lib.

The situation is described in this community topic with AsyncServer. But I've faced similar with another lib esp32-flashz

There are certain conditions that could prevent (or hide) this problem:

  1. lib A has defined bundled Arduino libs in manifest's "dependencies": [] section
  2. Including bundled lib's header files in some places could help there too

Usually it works fine with described conditions. However I faced really strange situation with GutHub's CI workflow that runs project builds with a lib and workaround 1) implemented.
LDF considers bundled lib names as some another third party lib names and pulls same named lib from the Platformio's registry, then build process obviously fails since this is a completely wrong lib.
In the CI job log it looks like this:

Library Manager: Installing git+https://github.com/vortigont/esp32-flashz#libdeps
git version 2.45.2
Cloning into '/home/runner/.platformio/.cache/tmp/pkg-installing-xwkyu2wm'...
Library Manager: esp32-flashz@1.1.4+sha.ce117d6 has been installed!
Library Manager: Resolving dependencies...
Library Manager: Installing Update
Library Manager: Installing Ticker
Library Manager: Warning! More than one package has been found by Ticker requirements:
Library Manager:  - sstaub/Ticker@4.4.0
Library Manager:  - jsc/Ticker@2.1.0
Library Manager: Please specify detailed REQUIREMENTS using package owner and version (shown above) to avoid name conflicts

Here LDF picks Ticker lib as some 3rd party instead of bundled Arduino's Ticker. Then pio pulls it from PlatformIO's registry and tries to include it instead of bundled one. This obviously fails:

.pio/libdeps/esp32debug/esp32-flashz/src/flashz-http.cpp:122:37: error: no matching function for call to 'Ticker::Ticker()'
                             t = new Ticker;
                                     ^~~~~~
In file included from .pio/libdeps/esp32debug/esp32-flashz/src/flashz-http.hpp:39,
                 from .pio/libdeps/esp32debug/esp32-flashz/src/flashz-http.cpp:30:
.pio/libdeps/esp32debug/Ticker/Ticker.h:74:2: note: candidate: 'Ticker::Ticker(fptr, uint32_t, uint32_t, resolution_t)'
  Ticker(fptr callback, uint32_t timer, uint32_t repeat = 0, resolution_t resolution = MICROS);
  ^~~~~~
.pio/libdeps/esp32debug/Ticker/Ticker.h:74:2: note:   candidate expects 4 arguments, 0 provided

Same project build on my local ubuntu machine completes fine. Not sure why in GitHub LDF behaves differently.

On the other hand, if I remove Ticker and Update from lib's manifest the build fails with fatal error: Update.h: No such file or directory both locally and in GitHub.

Summary: somehow LDF might exclude bundled Arduino libs from recursive dependency graphs.

vortigont added a commit to vortigont/platformio-core that referenced this issue Jun 21, 2024
LDF might mistakenly remove recursive dependency libs from a graph
usually platform bundled ones

Closes platformio#4940
@ivankravets ivankravets added help wanted ldf Library Dependency Finder labels Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted ldf Library Dependency Finder
Projects
None yet
Development

No branches or pull requests

2 participants