Closed
Description
Describe the bug
Compiling a sketch that includes <SD.h>
for ESP32 fails with a "Architecture or board not supported" error because the wrong library is used.
To Reproduce
- This might be a relevant step: I have Arduino 1.8 installed normally and I am running Arduino 2.0 from the ZIP (not installed).
- Install the ESP32 core via the board manager
- Set the board to for example "ESP32 Dev Module"
- Compile this sketch: (The one line is enough to reproduce the issue.)
#include <SD.h>
Actual behavior
An error happens:
C:\Program Files (x86)\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:\Program Files (x86)\Arduino\libraries\SD
Not used: C:\Users\andre\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\SD
Compilation error: Error: 13 INTERNAL: exit status 1
Expected behavior
Good question. I think the problem is there's an SD library bundled with the IDE and there is one bundled with the core and the one bundled with the IDE is used. Note that I have both Arduino 1.8 and Arduino 2.0 installed and I think the "Used" library comes from Arduino 1.8.
The error happens only in Arduino 2.0, so how does Arduino 1.8 handle this? I would assume the library from the core should take precedence over the library from the IDE?
Desktop (please complete the following information):
- OS: Windows
- Version: 2.0.0-beta.12
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
per1234 commentedon Nov 13, 2021
Hi @AndreKR. Thanks for your report.
This is caused by an intentional change to the Arduino CLI tool that handles the compilation process for the Arduino IDE. The full details on that change, and how it can cause the loss of priority for the platform bundled libraries in rare cases such as the one you experienced, are provided here: #1292
The fix for that has already been made in the ESP32 boards platform (espressif/arduino-esp32@de66c39), which was released in ESP32 boards 2.0.0. However, you are using an older version of the ESP boards platform (1.0.6), which doesn't have that change.
So you can pick one of the following options for fixing this:
AndreKR commentedon Nov 13, 2021
That was the first thing I tried, but I only got version 1.0.6.
In Arduino IDE 1.8:
In Arduino IDE 2.0:
per1234 commentedon Nov 13, 2021
This is because Arduino IDE 2.x only shows the already installed version of the platform if you don't have the platform's package index URL in your preferences. Arduino IDE 2.x has a completely different preferences storage system from the classic Arduino IDE, so the preferences from the classic Arduino IDE are not used by Arduino IDE 2.x.
Please try this:
,
).(restart is required because, due to a bug, Arduino IDE 2.x doesn't otherwise recognize changes to the "Additional Boards Manager URLs" preference)
Now you will be able to use Boards Manager to update the ESP32 boards platform to the latest version. After doing that, the correct SD library will be used.
AndreKR commentedon Nov 13, 2021
That worked.
Using the Preferences dialog also switched the IDE to the light theme. :)
By the way, why is the 2.0 version ignored by Arduino IDE 1.8, I don't see any obvious differences in the JSON?
AndreKR commentedon Nov 13, 2021
Ah, never mind, I was using a different board URL in Arduino IDE 1.8:
https://dl.espressif.com/dl/package_esp32_index.json
per1234 commentedon Nov 13, 2021
This bug is being tracked at arduino/arduino-ide#530
mathemaphysics commentedon Jul 5, 2024