You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Include path doesn't always contain the dependencies from a library.json file #4900
If you add #include <SparkFun_BMI270_Arduino_Library.h> to your name_of_your_library.h or cpp it will resolve all dependencies. Otherwise, you can set lib_ldf_mode = deep for your library. Docs:
Scanning dependencies...
Dependency Graph
|-- Platformio_bugLib @ 1.0.0+sha.24e33b8
Building in release mode
Compiling .pio\build\esp32\lib254\Platformio_bugLib\Platformio_bugLib.cpp.o
.pio/libdeps/esp32/Platformio_bugLib/Platformio_bugLib.cpp:1:10: fatal error: SparkFun_BMI270_Arduino_Library.h: No such file or directory
It makes no sense to me. I've just spent two hours deleting .pio folders, doing Clean, Full Clean, reinstalling platformio, trying with symlink:, file:, etc. Sometimes it has worked, most of the time it hasn't. Any clue is welcome.
I provided you with all the code I'm using. There's no hidden project file, the only one is main.cpp.
Or do you mean that I should add #include <Platformio_bugLib.h> to main.cpp? That wouldn't be good. I provide a library: it's up to the users of my library to decide if they want to include a file from my library or not. It should work the same in both cases.
Unfortunately, I cannot test whether adding #include <Platformio_bugLib.h> to main.cpp solves anything, because now it works properly! (without any change) The issue seems to occur randomly when you add or remove stuff in lib_deps. For example, I've just changed from https://github.com/sylque/Platformio_bugLib.git to symlink://../../../bugs/Platformio_bugLib (exact same library), and now it works! But I'm sure the issue will be back soon.
May I ask what's the behavior on your side with the code I provided?
Hi @sylque, strange, but I cannot reproduce the issue. I took your platformio.ini and main.cpp, then just ran the project. Although there was an issue with missing SPI and Wire libraries, but after adding them to lib_deps everything compiled just fine, here is the dependency graph from that project:
I believe your issue is probably a duplicate of #4885 that's already fixed in the dev branch. Please run pio upgrade --dev in the IDE terminal and try again.
Activity
ivankravets commentedon Apr 24, 2024
If you add
#include <SparkFun_BMI270_Arduino_Library.h>to yourname_of_your_library.h or cppit will resolve all dependencies. Otherwise, you can setlib_ldf_mode = deepfor your library. Docs:sylque commentedon Apr 24, 2024
Thanks @ivankravets .
Unfortunately, adding
#include <SparkFun_BMI270_Arduino_Library.h>toname_of_your_library.cppdoesn't work for me.My problem seems to be both simpler and stranger that what I originally described. Please see this repo of a minimal library:
https://github.com/sylque/Platformio_bugLib
And here is a simple project that includes this library:
platformio.ini:
main.cpp:
Compilation result:
It makes no sense to me. I've just spent two hours deleting .pio folders, doing Clean, Full Clean, reinstalling platformio, trying with symlink:, file:, etc. Sometimes it has worked, most of the time it hasn't. Any clue is welcome.
ivankravets commentedon Apr 24, 2024
Have you added
#include <Platformio_bugLib.h>to the one of the project files?sylque commentedon Apr 24, 2024
I provided you with all the code I'm using. There's no hidden project file, the only one is
main.cpp.Or do you mean that I should add
#include <Platformio_bugLib.h>tomain.cpp? That wouldn't be good. I provide a library: it's up to the users of my library to decide if they want to include a file from my library or not. It should work the same in both cases.Unfortunately, I cannot test whether adding
#include <Platformio_bugLib.h>tomain.cppsolves anything, because now it works properly! (without any change) The issue seems to occur randomly when you add or remove stuff inlib_deps. For example, I've just changed fromhttps://github.com/sylque/Platformio_bugLib.gittosymlink://../../../bugs/Platformio_bugLib(exact same library), and now it works! But I'm sure the issue will be back soon.May I ask what's the behavior on your side with the code I provided?
valeros commentedon Apr 24, 2024
Hi @sylque, strange, but I cannot reproduce the issue. I took your
platformio.iniandmain.cpp, then just ran the project. Although there was an issue with missing SPI and Wire libraries, but after adding them tolib_depseverything compiled just fine, here is the dependency graph from that project:Here is my test project if you're interested: platformio-core-issue-4900.zip
Am I missing something?
sylque commentedon Apr 24, 2024
@valeros , here is the full output when I compile your project:
valeros commentedon Apr 24, 2024
I believe your issue is probably a duplicate of #4885 that's already fixed in the dev branch. Please run
pio upgrade --devin the IDE terminal and try again.sylque commentedon Apr 24, 2024
@valeros , I confirm the issue doesn't occur with the dev branch. Thanks a million!
ivankravets commentedon Apr 25, 2024
PlatformIO Core 6.1.15 has been released!