Description
Bug Report
Current behavior
./arduino-cli core update-index --additional-urls https://arduino.esp8266.com/stable/package_esp8266com_index.json
./arduino-cli core install esp8266:esp8266 --additional-urls https://arduino.esp8266.com/stable/package_esp8266com_index.json
./arduino-cli lib install SD
- Create a sketch named Foo that contains the following:
#include <SD.h> void setup(){} void loop(){}
./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