Skip to content

--library flag not working with relative paths #1665

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
ubidefeo opened this issue Feb 15, 2022 · 0 comments · Fixed by #2126
Closed

--library flag not working with relative paths #1665

ubidefeo opened this issue Feb 15, 2022 · 0 comments · Fixed by #2126
Assignees
Labels
conclusion: resolved Issue was resolved criticality: medium Of moderate impact topic: CLI Related to the command line interface topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@ubidefeo
Copy link

Bug Report

Sometimes you want to download a library which is not available through the Library Manager or is in development (not released/tagged).
The workflow would be to keep this version of the library in a different place than the Sketchbook's libraries folder, especially if you already have another version of this library installed either manually or through the Library Manager.
When doing this, via arduino-cli you can specify --library and pass in a full path to the library.
One use case would be to cd into one of the examples and run a compile/upload targeting the path 2 folders up (../../).
This will result in an error or in the Library installed in the Sketchbook to be used if present.

Current behavior

I will be using ArduinoIoTCloud to explain what happens.
Install the library with arduino-cli lib install ArduinoIoTCloud. This will give us all the dependencies required.
Uninstall the library, this will remove only ArduinoIoTCloud and not the installed dependencies:
arduino-cli uninstall ArduinoIoTCloud

  • download the library from its repo (https://github.com/arduino-libraries/ArduinoIoTCloud) to a folder of your choosing (for me it'll be ~/Downloads)
  • expand the archive
  • cd into its examples folder and ArduinoIoTCloud-Basic
    $> cd ~/Downloads/ArduinoIoTCloud/examples/ArduinoIoTCloud-Basic
  • try to compile the example with arduino-cli compile -b arduino:samd:nano_33_iot --library ../../ -v
    The path is valid, but compilation will end with the following error
    Error during build: stat ../../../src/ArduinoIoTCloud.cpp: no such file or directory

If on the other hand I pass in the full path it will compile without issues
arduino-cli compile -b arduino:samd:nano_33_iot --library ~/Downloads/ArduinoIoTCloud-master

If the library is re-installed arduino-cli lib install ArduinoIoTCloud, when passing ../../ as path to the Library there will be no error, but the library will be picked from the Sketchbook's libraries folder

$~ArduinoIoTCloud-Basic> arduino-cli compile -b arduino:samd:nano_33_iot --library ../../ -v
...
...
Multiple libraries were found for "ArduinoIoTCloud.h"
  Used: /Users/ubidefeo/data/Dropbox/AppsDocuments/Arduino/libraries/ArduinoIoTCloud
  Not used: /Users/ubidefeo/data/GITHub/Arduino-Libs/ArduinoIoTCloud

Expected behavior

When passing in a valid path to a Library, it should always be chosen above all other instances of it

Environment

  • CLI version (output of arduino-cli version): 0.21.0
  • OS and platform: Mac OS 12.2.1 Monterey
@ubidefeo ubidefeo added criticality: medium Of moderate impact type: imperfection Perceived defect in any part of project labels Feb 15, 2022
@cmaglie cmaglie assigned cmaglie and unassigned silvanocerza Jun 3, 2022
@per1234 per1234 added the topic: code Related to content of the project itself label Nov 8, 2022
@per1234 per1234 changed the title --library flag not working with relative paths --library flag not working with relative paths Nov 8, 2022
@cmaglie cmaglie assigned MatteoPologruto and unassigned cmaglie Mar 17, 2023
@umbynos umbynos added the topic: CLI Related to the command line interface label Mar 20, 2023
@per1234 per1234 added the conclusion: resolved Issue was resolved label Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved criticality: medium Of moderate impact topic: CLI Related to the command line interface topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
6 participants