I am new to PlatformIO, but I suspect a bug. However, easy to reproduce
Install library U8g2, for Platform nordicnrf51 Framework Arduino
Compile example HelloWorld from U8g2, compiles ok
Dependency Graph
|-- <'U8g2> v2.22.6
| |-- <'Wire> v1.0
| |-- <'SPI> v1.0
|-- <'SPI> v1.0
…
SUCCESS
but when I add lib_ldf_mode = chain+ or lib_ldf_mode = deep+
Dependency Graph
|-- <'U8g2> v2.22.6
…platformio\lib\U8g2_ID942\src\U8x8lib.cpp:42:10: fatal error: SPI.h: No such file or directory
ERROR
It works ok with: lib_ldf_mode = chain or lib_ldf_mode = deep
Unfortunately, I need + for a PIN boards definitions
Is there anybady who can fix it, please?
I did and the problem still exists, I have loaded spi.h into src - problem still exists, then I loaded the file into project lib - problem still exists, then I loaded the file into U8g2 library folder then shows missing wire.h, and so on
sorry to bump this old thread, but the issue is still happening.
I’m using:
Core 3.6.2a2
and what I did was to clone this project: GitHub - bitluni/MiniGame
with this platformio.ini file:
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:esp8266]
platform=espressif8266
framework=arduino
board=d1_mini
lib_deps =
# Using a library name
SparkFun Micro OLED Breakout
[platformio]
src_dir=./MiniGame/
and got this error: .piolibdeps/SparkFun Micro OLED Breakout_ID366/src/hardware.cpp:38:17: fatal error: SPI.h: No such file or directory
But including #include <SPI.h> in MiniGame.ino solved the issue.
This error does not happen if I compile it from Arduino IDE.
In file included from .piolibdeps/RadioHead_ID124/RHCRC.h:12:0,
from .piolibdeps/RadioHead_ID124/RHCRC.cpp:43:
.piolibdeps/RadioHead_ID124/RadioHead.h:1179:19: fatal error: SPI.h: No such file or directory
The strange thing is: within vscode, if I ctrl-click on the #include <SPI.h> statement the compiler dislikes in RadioHead.h line 1179, I’ll jump into an existing SPI.h in ./packages/framework-arduinoavr/libraries/cores/arduino/SPI/src/SPI.h
So, vscode seems to be smarter than the compiler. Meh!
Do you use PlatformIO IDE? If yes, do you use the latest development version? Please run pio --version in IDE terminal. Also, don’t forget to $ pio update. We had similar issue which was fixed a few days ago.
I have a problem with the same symptoms. A very simple Arduino sketch, no actual code - just setting up the project. I added Adafruit GFX Library (from Github repository, not from PIO repo), and now the project doesn’t compile as the library cannot find SPI.h. If I include it at the top of my main.cpp, the project does compile, but this include is not necessary in Arduino IDE, and I think it wasn’t necessary for PIO a while ago.
Tried the following lib_ldf_mode values:
default (no lib_ldf_mode)
2
deep
chain
deep+
chain+
None work. I would like to get rid of the #include <SPI.h> if possible.
Windows 10, VS Code, PIO 4.0.0rc4. Compiling for Arduino Due board.
As of 2021 the problem still occur. I use arduino mega 2560 and the arduino framework. Core pio is 5.0.4 and Home is 3.3.1
I have written my own library that has a dependency on mcp2515 library. MCP2515 depends on SPI.h. The issue came suddenly without changes. Can be temporarily solved by including in the main.cpp of the project SPI.h or by adding SPI.h dependency into library.json or by deep+ in platformio.ini
Edit:
After playing around with includes and dependencies the problem resolved the same as appear, just because of no reason. I have now the same state as before the problem. No includes, no dependencies no ldf params.
I suspect that the order of dependency walktrough of ldf has some issue. The spi lib was more far behind as the issue occured. Now SPI lib is again more at the start of ldf process. It is also now one at the only time it was found, back before at the problem it resolved multiple times.