Skip to content

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

Closed
@per1234

Description

@per1234

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions