Skip to content

Automatically install library dependencies for libraries in sketch profile #2934

Not planned
@Ravgni

Description

@Ravgni

Describe the request

Download libraries' dependencies for libraries in sketch profile

E.g. this profile should install 'Adafruit SSD1306' and dependencies 'Adafruit GFX Library' and 'Adafruit BusIO':

profiles:
  esp32:
    fqbn: esp32:esp32:esp32
    platforms:
      - platform: esp32:esp32 (3.2.0)
    libraries:
      - Adafruit SSD1306 (2.5.14)

Describe the current behavior

When invoking arduino-cli compile dependencies for libraries in profile file are not downloaded.
E.g. if user executed arduino-cli lib install "Adafruit SSD1306" then three libraries will be installed: 'Adafruit SSD1306' itself and it's dependencies 'Adafruit GFX Library' and 'Adafruit BusIO'
But if user states in sketch profile only one library 'Adafruit SSD1306' then only this one installed. And it's dependencies are missing.

Arduino CLI version

1.2.2

Operating system

Linux

Operating system version

Ubuntu 22.04

Additional context

No response

Issue checklist

  • I searched for previous requests in the issue tracker
    I verified the feature was still missing when using the nightly build
    My request contains all necessary details

Activity

added
topic: codeRelated to content of the project itself
topic: package-managementRelated to the packaging and managing of the platform/libraries
on Jun 16, 2025
self-assigned this
on Jun 16, 2025
per1234

per1234 commented on Jun 16, 2025

@per1234
Contributor

Thanks for your suggestion @Ravgni. One of the purposes of build profiles is to provide reproducible builds. Since the library developer is not required to specify exact versions of their dependencies (and most don't do that, especially since version constraints were added only recently), automatically installing dependencies would result in non-reproducible builds (since the versions of the automatically installed transitive dependencies that are installed could change depending on when the build profile environment was created).

The situation would be different if a "lockfile" (e.g., npm's package-lock.json or Poetry's poetry.lock) approach had been chosen for Arduino CLI's build profiles. However, the chosen design is for the build profile to define all dependencies required for a reproducible build of the sketch project in an isolated environment, so the build profile must specify the transitive dependencies in addition to the direct dependencies.

This is not a problem because you can make Arduino CLI generate the build profile for you. Just do a compilation of your sketch without using a build profile, adding the --dump-profile flag to the arduino-cli compile command. The generated profile will contain the transitive dependencies in addition to the direct dependencies.

There is also currently a proposal to add an arduino-cli profile lib add <library name> command, which can be used to add a library dependency, along with its dependencies, to the build profile:

#2917 (review)

Ravgni

Ravgni commented on Jun 17, 2025

@Ravgni
Author

Thanks for clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Automatically install library dependencies for libraries in sketch profile · Issue #2934 · arduino/arduino-cli