Skip to content

--dump-profile should emit dir: for non-index libraries to make profile builds reproducible #3017

@thelastoutpostworkshop

Description

@thelastoutpostworkshop

Describe the problem

When running arduino-cli compile --dump-profile, the generated profile lists all libraries as Name (Version). This works for libraries available in the Library Index, but not for ZIP-installed libraries.
When compiling with --profile, the build runs in an isolated environment and ignores globally installed libraries. As a result, the profile fails to resolve headers from ZIP-installed libraries unless the user manually edits the profile and replaces Name (Version) with dir: entries pointing to the library folder.

To reproduce

  • Install a library from a ZIP file into the sketchbook, e.g. ~/Arduino/libraries/NMEA2000.
  • Create a sketch that uses a header from that library, e.g. #include <NMEA2000_CAN.h>.
  • Run:
    - arduino-cli compile --fqbn esp32:esp32:esp32s3 --dump-profile /path/to/sketch
    the dumped profile lists NMEA2000 (4.22.1) under libraries.
  • Try compiling with that profile:
    arduino-cli compile --profile Guition /path/to/sketch
  • compilation fails with:
Alternatives for NMEA2000_CAN.h: []
ResolveLibrary(NMEA2000_CAN.h)
  -> candidates: []
fatal error: NMEA2000_CAN.h: No such file or directory

Expected behavior

--dump-profile should detect that the library is not available from the Index and instead emit a dir: entry:

libraries:
  - dir: /home/user/Arduino/libraries/NMEA2000

This would ensure the dumped profile is reproducible and matches the isolation design of profiles. Optionally, a flag like --dump-profile=prefer-local could let users force dir: output.

Arduino CLI version

1.3.1

Operating system

Linux

Operating system version

Ubuntu 24.04

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftopic: package-managementRelated to the packaging and managing of the platform/librariestype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions