SD library dependency issue on ESP8266

Hi, I’ve got an issue with a library which depends on SD. Already tried to track this down as far as I can.

contents of platformio.ini

platform = espressif8266
framework = arduino
upload_speed = 921600
monitor_speed = 115200
board = d1

lib_deps =
  Adafruit VS1053 Library


#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <SPI.h>
#include <SD.h>

void setup() {

void loop() {

When trying to compile it with pio run, the build fails. I guess that it includes the Arduino SD library instead of using the Espressif one.

Processing d1 (platform: espressif8266; framework: arduino; board: d1)
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: Espressif 8266 (3.2.0) > WEMOS D1 R1
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
 - framework-arduinoespressif8266 3.30002.0 (3.0.2)
 - tool-esptool 1.413.0 (4.13)
 - tool-esptoolpy 1.30000.201119 (3.0.0)
 - toolchain-xtensa 2.100300.210717 (10.3.0)
Converting main.ino
LDF: Library Dependency Finder ->
LDF Modes: Finder ~ chain, Compatibility ~ soft
Library Manager: Installing git+
git version 2.33.1
Cloning into '/home/jalr/.platformio/.cache/tmp/pkg-installing-2org4py8'...
Library Manager: Adafruit VS1053 Library @ 1.2.1+sha.b80d50d has been installed!
Found 38 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Adafruit VS1053 Library> 1.2.1+sha.b80d50d
|   |-- <SD> 0.0.0-alpha+sha.041f788250
|   |   |-- <SPI> 1.0
|   |-- <SPI> 1.0
|-- <ESP8266WiFi> 1.0
|-- <SD> 0.0.0-alpha+sha.041f788250
|   |-- <SPI> 1.0
|-- <SPI> 1.0
Building in release mode
Compiling .pio/build/d1/src/main.ino.cpp.o
Generating LD script .pio/build/d1/ld/
Compiling .pio/build/d1/lib57c/SPI/SPI.cpp.o
Compiling .pio/build/d1/lib929/SD/File.cpp.o
Compiling .pio/build/d1/lib929/SD/SD.cpp.o
Compiling .pio/build/d1/lib929/SD/utility/Sd2Card.cpp.o
Compiling .pio/build/d1/lib929/SD/utility/SdFile.cpp.o
Compiling .pio/build/d1/lib929/SD/utility/SdVolume.cpp.o
In file included from .pio/libdeps/d1/SD/utility/Sd2Card.h:26,
                 from .pio/libdeps/d1/SD/utility/SdFat.h:29,
                 from .pio/libdeps/d1/SD/utility/SdFile.cpp:20:
.pio/libdeps/d1/SD/utility/Sd2PinMap.h:371:2: error: #error Architecture or board not supported.

I forked the Adafruit VS1053 library, and removed the SD dependency in file:

diff --git a/ b/
index d225261..a77ff6e 100644
--- a/
+++ b/
@@ -7,4 +7,4 @@ paragraph=This is a library for the Adafruit VS1053 Codec Breakout and Music Mak
 category=Device Control

When using the forked library my code compiles. I’m not very familiar with the platformio build system and don’t know how this issue can be fixed properly. Please let me know where I can report this issue. Does it need to be fixed in the Adafruit lib, in platform-core or platform-espressif8266?

Very good point. I think since the core contains the library searcher and decides which library will be built, it’s good to open an issue there. I don’t think the Adafruit people will want to modify their in regards to removing the depends=SD line just so that PlatformIO will work properly.

If I remember correctly, previously, you could use lib_ignore = SD and then inject the correct SD libary, named SD(esp8266), but this does not work anyore as the name has apparently changed. The Arduino library naming situation is not good, there are too many SD libaries and there’s no distinction as to which exact one is meant.

You can also use a workaround where you redirect the SD library to the good local framework version.

platform = espressif8266
board = d1
framework = arduino
lib_deps =
  Adafruit VS1053 Library

worked for my system.

1 Like

Thank you. I’ve opened an issue: Arduino SD library dependency issue on ESP8266 · Issue #4176 · platformio/platformio-core · GitHub
Your workaround also works fine for me.