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

Library installed in sketchbook is given priority when core bundled library is better architecture match #572

Closed
per1234 opened this issue Jan 31, 2020 · 4 comments

Comments

@per1234
Copy link
Contributor

per1234 commented Jan 31, 2020

Bug Report

Current behavior

  1. ./arduino-cli core update-index --additional-urls https://arduino.esp8266.com/stable/package_esp8266com_index.json
  2. ./arduino-cli core install esp8266:esp8266 --additional-urls https://arduino.esp8266.com/stable/package_esp8266com_index.json
  3. ./arduino-cli lib install SD
  4. Create a sketch named Foo that contains the following:
    #include <SD.h>
    void setup(){}
    void loop(){}
  5. ./arduino-cli compile --fqbn esp8266:esp8266:generic Foo

Compilation fails:

C:\Users\per\Documents\Arduino\libraries\SD\src/utility/Sd2PinMap.h:524:2: error: #error Architecture or board not supported.
 #error Architecture or board not supported.
  ^
Multiple libraries were found for "SD.h"
 Used: C:\Users\per\Documents\Arduino\libraries\SD
 Not used: C:\Users\per\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\SD

Expected behavior

The architectures field of C:\Users\per\Documents\Arduino\libraries\SD\library.properties:
https://github.com/arduino-libraries/SD/blob/1.2.4/library.properties#L9

architectures=*

The architectures field of C:\Users\per\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\SD
https://github.com/esp8266/Arduino/blob/2.6.3/libraries/SD/library.properties#L9

architectures=esp8266

Since the library bundled with the core is a better architecture match than the one installed in the sketchbook (explicit match > wildcard match), it should get priority. This is how the priority system has worked historically.

Environment

  • CLI version (output of arduino-cli version): 0.7.0-rc1 Commit: afdf259
  • OS and platform: Windows 10 64 bit

Additional context

The bug does not occur at fc9b70b.

The bug does occur at cca6936.

I remember we had similar problems during the development of arduino-builder. It might be helpful to clearly document the intended library include priorities. This would make it easy to create tests to ensure the correct priorities are maintained.

Originally reported at:
https://forum.arduino.cc/index.php?topic=661342.msg4458460#msg4458460

@ubidefeo
Copy link

Thanks for reporting, @per1234
I just bumped into this a few hours ago because on a system I still had an old version of ArduinoIoTCloud which was manually installed during development.
I was sure the one installed by arduino-cli was up-to-date and it compiled without issues.
Then I saw the lib in the sketch's libraries folder, chucked it and it all just worked

@ubidefeo
Copy link

I'd also add that, as a development aid, we should allow a flag in the CLI to permit the use of a llibrary from the user folder to override the core one

@JAndrassy
Copy link

ESP32 boards package has this problem with WiFi library. builder uses the old WiFi library bundled with IDE instead of ESP32 WiFi library

@JAndrassy
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants