Skip to content

lib list --fqbn does not shown platform bundled lib when lib of same name installed globally #1566

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

Closed
3 tasks done
per1234 opened this issue Nov 23, 2021 · 0 comments · Fixed by #2113
Closed
3 tasks done
Assignees
Labels
criticality: medium Of moderate impact priority: low Resolution is a low priority topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@per1234
Copy link
Contributor

per1234 commented Nov 23, 2021

Describe the problem

It is a common practice for boards platforms to contain platform bundled libraries that are a variant of a common library distributed via Library Manager, modified to be compatible with the architecture of the boards platform (example).

🐛 arduino-cli lib list does not list the platform bundled library when the library of the same name is installed globally (e.g. in directories.user).

To reproduce

$ arduino-cli version
arduino-cli.exe alpha Version: nightly-20211112 Commit: bf4a784 Date: 2021-11-12T01:26:50Z

$ arduino-cli lib uninstall USBHost  # Clean up in case you already had the lib installed
$ arduino-cli core install arduino:samd
$ arduino-cli lib list --all --fqbn arduino:samd:mkrzero USBHost
Name    Installed       Available     Location            Description
USBHost 1.0             1.0.5         arduino:[email protected] Allows the communication with USB per...

🙂 Output is as expected

$ arduino-cli lib install USBHost
$ arduino-cli lib list USBHost
Name    Installed     Available         Location              Description
USBHost 1.0.5         -                 LIBRARY_LOCATION_USER -

🙂 Output is as expected

$ arduino-cli lib list --all USBHost
Name    Installed Available  Location                                Description
USBHost 1.0.5     -          LIBRARY_LOCATION_USER                   -
USBHost 1.0       1.0.5      arduino:[email protected]                     Allows the communication with USB per...

🙂 Output is as expected

$ arduino-cli lib list --all --fqbn arduino:samd:mkrzero USBHost
No libraries installed.

🐛 The library is not listed even it is installed.

Because the LIBRARY_LOCATION_USER installed version of "USBHost" is specified for sam architecture, it is reasonable that it not be shown in arduino-cli lib list --fqbn arduino:samd:mkrzero output (because that board is samd architecture), but the version of the library bundled with the arduino:samd platform should be shown.

Expected behavior

arduino-cli lib list --all --fqbn should always list all installed libraries matching the search query.

Arduino CLI version

nightly-20211112 Commit: bf4a784

Operating system

Windows

Operating system version

10

Additional context

The compilation process correctly discovers the platform bundled library even though it was not shown in the lib-list --fqnb output:

$ mkdir /tmp/SomeUSBHostSketch
$ printf "#include <KeyboardController.h>\nvoid setup() {}\nvoid loop() {}\n" > /tmp/SomeUSBHostSketch/SomeUSBHostSketch.ino  # sketch that uses an arbitrary header from the USBHost libs
$ arduino-cli compile -b arduino:samd:mkrzero -v /tmp/SomeUSBHostSketch
[...]
Multiple libraries were found for "KeyboardController.h"
 Used: C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.11\libraries\USBHost
 Not used: C:\Users\per\Documents\Arduino\libraries\USBHost
Using library USBHost at version 1.0 in folder: C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.11\libraries\USBHost
[...]

Even though it results in the example above exhibiting the most dramatic form of the bug's manifestation, the bug is not dependent on an architecture mismatch of the Library Manager lib, as the demonstration below shows.

In the following demonstration, the globally installed library is shown in the lib list output because it is compatible with the board's mbed_portenta architecture, but the platform bundled library is incorrectly not shown in the output, just as in the previous demonstration.

$ arduino-cli lib uninstall WiFi  # Clean up in case you already had the lib installed
$ arduino-cli core install arduino:mbed_portenta
$ arduino-cli lib list --all --fqbn arduino:mbed_portenta:envie_m7 WiFi  # Output is as expected
Name Installed       Available     Location                    Description
WiFi 1.0             1.2.7         arduino:[email protected] WiFi wrapper for mbed wifi classes

$ arduino-cli lib install WiFi
$ arduino-cli lib list WiFi # Output is as expected
Name Installed     Available         Location              Description
WiFi 1.2.7         -                 LIBRARY_LOCATION_USER -

$ arduino-cli lib list --all WiFi  # Output is as expected
Name Installed  Available  Location                    Description
WiFi 1.2.7      -          LIBRARY_LOCATION_USER       -
 "   1.0        1.2.7      arduino:[email protected] WiFi wrapper for mbed wifi classes

$ arduino-cli lib list --all --fqbn arduino:mbed_portenta:envie_m7 WiFi  # Output not as expected!
Name Installed     Available         Location              Description
WiFi 1.2.7         -                 LIBRARY_LOCATION_USER -

$ mkdir /tmp/SomeWiFiSketch
$ printf "#include <WiFi.h>\nvoid setup() {}\nvoid loop() {}\n" > /tmp/SomeWiFiSketch/SomeWiFiSketch.ino  # sketch that uses an arbitrary header from the WiFi libs
$ arduino-cli compile -b arduino:mbed_portenta:envie_m7 -v /tmp/SomeWiFiSketch
[...]
Multiple libraries were found for "WiFi.h"
 Used: C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\mbed_portenta\2.5.2\libraries\WiFi
 Not used: C:\Users\per\Documents\Arduino\libraries\WiFi
Using library WiFi at version 1.0 in folder: C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\mbed_portenta\2.5.2\libraries\WiFi
[...]

arduino-cli lib list --all --fqbn could be a very useful tool for investigating library dependency resolution outcomes, which are regularly a source of confusion for platform and library developers and users when a different library from the one they expected is selected. But, with this bug, it would end up only contributing more confusion since the library that will be selected by the build system is not even shown in the lib list output.

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
@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Nov 23, 2021
@ubidefeo ubidefeo assigned cmaglie and unassigned silvanocerza Jul 25, 2022
@ubidefeo ubidefeo added priority: low Resolution is a low priority criticality: medium Of moderate impact labels Jul 25, 2022
@per1234 per1234 changed the title lib list --fqbn does not shown platform lib when lib of same name installed globally lib list --fqbn does not shown platform bundled lib when lib of same name installed globally Nov 8, 2022
@umbynos umbynos added this to the Arduino CLI 1.0 milestone Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
criticality: medium Of moderate impact priority: low Resolution is a low priority topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
6 participants