How to tell which libraries to add for Arduino Project?

This is a possibly very silly newbie question, but I didn’t see an explanation anywhere that I searched with my error message, so, here we go.

I have a platformio.ini that was working okay:

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = rpipicow
framework = arduino
board_build.core = earlephilhower
upload_protocol = cmsis-dap
debug_tool = cmsis-dap
lib_ldf_mode = chain+
build_flags = -std=c++20

Then I added:

lib_deps = 
    adafruit/Adafruit BusIO@^1.16.1

This leads to compiler errors:

*************************************************************
* Looking for SPI.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:SPI.h"
* Web  > https://registry.platformio.org/search?q=header:SPI.h
*
*************************************************************

    9 | #include <SPI.h>
      |          ^~~~~~~

Okay, let’s try that:

Well that isn’t promising. I don’t want a fake!

Through various searching, I learned that I need to add these libraries to make things work:

lib_deps = 
    SPI
    I2C
    Wire
    adafruit/Adafruit BusIO@^1.16.1

Now things compile splendidly.

I have questions!

  • Should the given library be updated to list these transitive dependencies, so that I don’t have to list them explicitly?
  • How was I to know the names of these dependencies? Is the name always identical to the name of the header file, or is there some other rule?
  • Given these libraries do not appear in the registry, is there a way to get a complete listing of the libraries available on my particular platform/framework?

Thank you in advance for entertaining my complete noobriety.