Compilation error Arduino 2.0 - sd.h

Hi experts,

I having trouble if I compile my esp32 sketch on mac with the latest Arduino 2.0. The compilation with an older version 1.8.16 is ok. All selceted esp32 boards have the same error message.

Attached the error message.

WARNUNG: Bibliothek SDS011_sensor_Library behauptet auf esp8266, avr Architektur(en) ausgeführt werden zu können und ist möglicherweise inkompatibel mit Ihrem derzeitigen Board, welches auf esp32 Architektur(en) ausgeführt wird.
In file included from /Users/Kanbach/Library/Arduino15/libraries/SD/src/utility/Sd2Card.h:26:0,
from /Users/Kanbach/Library/Arduino15/libraries/SD/src/utility/SdFat.h:29,
from /Users/Kanbach/Library/Arduino15/libraries/SD/src/SD.h:20,
from /Users/Kanbach/Documents/Arduino/sketch_ESP32_web_sd_sds011_pms/sketch_ESP32_web_sd_sds011_pms.ino:19:
/Users/Kanbach/Library/Arduino15/libraries/SD/src/utility/Sd2PinMap.h:524:2: error: #error Architecture or board not supported.
#error Architecture or board not supported.
^
Mehrere Bibliotheken wurden für "SD.h" gefunden
Benutzt: /Users/Kanbach/Library/Arduino15/libraries/SD
Nicht benutzt: /Users/Kanbach/Library/Arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/SD
exit status 1

Compilation error: exit status 1Vorformatierter Text

Best regards
Andreas

Hi @andreas1958. One of the convenient features of the Arduino IDE is "library discovery". This is the process where the Arduino IDE automatically finds the library matching each of the #include directives in your sketch and in the libraries used by your sketch. Without this feature, we would need to configure the path to every library used, which would make the use of libraries much less beginner friendly, and also less convenient for all users.

In some cases, multiple libraries might contain a file matching the #include directive. In this case, the IDE must decide which of the libraries it should use. You can see that was the case here:

A change was made last year in the way the Arduino IDE decides which library to use. In general, this change made it more likely the IDE would pick the right library, but in some rare cases it did just the opposite:

This was discovered during the initial implementation of the feature and Arduino decided that the change should be postponed until all platforms had made the required adjustment, which they did.

So the change should not impact those who are using updated versions of boards platforms. The reason you are affected is because you are using a significantly outdated version of the ESP32 boards platform (1.0.6) from before the fix was made in that platform:

https://github.com/espressif/arduino-esp32/pull/5182

The easiest fix is to simply update your ESP32 boards platform. I'll provide instructions:

  1. Select File > Preferences from the Arduino IDE menus.
  2. Enter the following URL into the "Additional Boards Manager URLs" field:
    https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
    
    :exclamation: If there are already Boards Manager URLs in the field, separate them with commas.
  3. Click the OK button.
  4. You will now see a "Downloading index: ..." notification at the bottom right corner of the IDE window. Wait for that notification to close.
  5. Select Tools > Board > Boards Manager from the Arduino IDE menus to open the "Boards Manager" view in the left side panel.
  6. Scroll down through the list of boards platforms until you see the "esp32 by Espressif Systems" entry. Hover the mouse pointer over that entry.
  7. You will now see a version menu. Make sure "2.0.5" is shown as selected in the menu.
  8. You will also see an "INSTALL" button at the bottom of the entry. Click the button.
  9. Wait for the update to finish.

You should now be able to compile your sketch without getting that error.


Most often when I see people using version 1.0.6 of the ESP32 boards platform, it is because they had the old URL in their "Additional Boards Manager URLs" preference. Espressif changed the URL some time ago and stopped maintaining the old one. So people who use the old URL get 1.0.6 and don't receive any update notifications for all the releases of the platform made since then.

There is also the possibility you are intentionally using 1.0.6 because you wanted to avoid some change made after that, or because you have already validated your projects for use with that version. In this case, it is possible to find a way to force the IDE to use the right library and I can provide instructions for that if needed.

1 Like

Hi Ptillisch,

many thanks for your help, after successful update the ESP32 board to 2.0.5 accordingly your instructions the compliation is now ok.

BR
andreas1958

You are welcome. I'm glad it is working now.

Regards,
Per

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.