Unable to resolve dependency

Hello,

I am trying to install the RTClib library which depends on adafruit’s BusIO library. The installation works fine for both RTClib and BusIO, but when I’m trying to build the project, the compiler is unable to find the file Adafruit_I2CDevice.h, even though I can see it under .pio/libdeps/nanoatmega328/Adafruit BusIO/Adafruit_I2CDevice.h

I can also see an entry in c_cpp_properties.json’s includePath that has "c:/libtest/.pio/libdeps/nanoatmega328/Adafruit BusIO"

I have found these two questions which appear to be a similar issues

Unfortunately, the solution on the second question does not appear valid. I am testing on a newly created project with only RTClib as a dependency.

Here is my platformio.ini (version 3.3.1)

[env:nanoatmega328]
platform = atmelavr
board = nanoatmega328
framework = arduino
lib_ldf_mode = chain+
lib_deps = adafruit/RTClib@^2.1.1

And here is my output after deleting .pio, trimmed to the first error

Processing nanoatmega328 (platform: atmelavr; board: nanoatmega328; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Library Manager: Installing adafruit/RTClib @ ^2.1.1
Unpacking  [####################################]  100%
Library Manager: RTClib@2.1.1 has been installed!
Library Manager: Resolving dependencies...
Library Manager: Installing Adafruit BusIO
Unpacking  [####################################]  100%
Library Manager: Adafruit BusIO@1.14.5 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/nanoatmega328.html
PLATFORM: Atmel AVR (4.2.0) > Arduino Nano ATmega328
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 30KB Flash
DEBUG: Current (avr-stub) External (avr-stub, simavr)
PACKAGES:
 - framework-arduino-avr @ 5.1.0
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain+, Compatibility ~ soft
Found 7 compatible libraries
Scanning dependencies...
Dependency Graph
|-- RTClib @ 2.1.1
Building in release mode
Compiling .pio\build\nanoatmega328\src\main.cpp.o
Compiling .pio\build\nanoatmega328\lib450\RTClib\RTC_DS1307.cpp.o
Compiling .pio\build\nanoatmega328\lib450\RTClib\RTC_DS3231.cpp.o
Compiling .pio\build\nanoatmega328\lib450\RTClib\RTC_Micros.cpp.o
Compiling .pio\build\nanoatmega328\lib450\RTClib\RTC_Millis.cpp.o
Compiling .pio\build\nanoatmega328\lib450\RTClib\RTC_PCF8523.cpp.o
Compiling .pio\build\nanoatmega328\lib450\RTClib\RTC_PCF8563.cpp.o
Compiling .pio\build\nanoatmega328\lib450\RTClib\RTClib.cpp.o
Archiving .pio\build\nanoatmega328\libFrameworkArduinoVariant.a
Compiling .pio\build\nanoatmega328\FrameworkArduino\CDC.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\HardwareSerial0.cpp.o
In file included from .pio\libdeps\nanoatmega328\RTClib\src\RTC_DS1307.cpp:1:0:
.pio\libdeps\nanoatmega328\RTClib\src\RTClib.h:25:10: fatal error: Adafruit_I2CDevice.h: No such file or directory

If anybody has any insight, it would be greatly appreciated, thank you!

Update:

updating my platformio.ini to include the dependency yields some progress

[env:nanoatmega328]
platform = atmelavr
board = nanoatmega328
framework = arduino
lib_ldf_mode = chain+
lib_deps = 
	adafruit/RTClib@^2.1.1
	adafruit/Adafruit BusIO@^1.14.5

with this build output

Processing nanoatmega328 (platform: atmelavr; board: nanoatmega328; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Library Manager: Installing adafruit/RTClib @ ^2.1.1
Unpacking  [####################################]  100%
Library Manager: RTClib@2.1.1 has been installed!
Library Manager: Resolving dependencies...       
Library Manager: Installing Adafruit BusIO
Unpacking  [####################################]  100%
Library Manager: Adafruit BusIO@1.14.5 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/nanoatmega328.html
PLATFORM: Atmel AVR (4.2.0) > Arduino Nano ATmega328
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 30KB Flash     
DEBUG: Current (avr-stub) External (avr-stub, simavr)
PACKAGES:
 - framework-arduino-avr @ 5.1.0
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain+, Compatibility ~ soft
Found 7 compatible libraries
Scanning dependencies...
Dependency Graph
|-- RTClib @ 2.1.1
|-- Adafruit BusIO @ 1.14.5
Building in release mode
Compiling .pio\build\nanoatmega328\src\main.cpp.o
Compiling .pio\build\nanoatmega328\lib5d7\Adafruit BusIO\Adafruit_BusIO_Register.cpp.o
Compiling .pio\build\nanoatmega328\lib5d7\Adafruit BusIO\Adafruit_I2CDevice.cpp.o
Compiling .pio\build\nanoatmega328\lib5d7\Adafruit BusIO\Adafruit_SPIDevice.cpp.o
Compiling .pio\build\nanoatmega328\lib450\RTClib\RTC_DS1307.cpp.o
Compiling .pio\build\nanoatmega328\lib450\RTClib\RTC_DS3231.cpp.o
Compiling .pio\build\nanoatmega328\lib450\RTClib\RTC_Micros.cpp.o
Compiling .pio\build\nanoatmega328\lib450\RTClib\RTC_Millis.cpp.o
Compiling .pio\build\nanoatmega328\lib450\RTClib\RTC_PCF8523.cpp.o
Compiling .pio\build\nanoatmega328\lib450\RTClib\RTC_PCF8563.cpp.o
Compiling .pio\build\nanoatmega328\lib450\RTClib\RTClib.cpp.o
Archiving .pio\build\nanoatmega328\libFrameworkArduinoVariant.a
In file included from .pio\libdeps\nanoatmega328\Adafruit BusIO/Adafruit_BusIO_Register.h:9:0,
                 from .pio\libdeps\nanoatmega328\Adafruit BusIO\Adafruit_BusIO_Register.cpp:1:
.pio\libdeps\nanoatmega328\Adafruit BusIO/Adafruit_I2CDevice.h:5:10: fatal error: Wire.h: No such file or directory

Cut short for post length. I tried to import Wire.h from my main.cpp because that’s a library I have used in the past, and lo and behold, that made that error go away, but replaced it with a missing SPI.h. I added an include to SPI.h in main.cpp and that fixed it

#include <Arduino.h>
#include <Wire.h>
#include <SPI.h>

void setup() {
}

void loop() {
}

For now I guess the issue is “resolved” but that’s a bandaid and I have absolutely no idea what’s going on, though I am 99.9% sure the issue is on my side. If anybody has any idea what I’m doing wrong, you will make my day!

Thank you