Closed JamesNewton closed 3 years ago
Even uninstalling the library still caused the build to fail. I had to go into the projects (hidden) .pio/libdeps/nodemcuv2 folder and delete ESP32Servo subfolder from it. No idea how that got put in there in the first place.
this is a bug in how platformIO manages libraries, outside of scope of this repo.
A possible workaround to the PIO bug would be to use compiler gaurds around the include of this libraries headers. the Nodemcu is a very different processor to the esp32, and they do not have any underlying libraries in common. This library is an extension of LEDC stack, which does not even exist in the esp8266 stack.
Can you point to or somehow describe the bug in PlatformIO?
Libraries poison the cache, basically if a project was ever configured to use a library, its compiled in no matter what until you clear the cache. you basically have to clear the cache when switching configurations. PlatformIO is just not designed to robustly clean up after itself when changing architectures. Your work around or deleting the .pio directory is the actual, and AFAIK only, solution. PIO copies the library into the build directory and uses local build wild cards to compile all libraries in that cache for every build.
By contrast Arduino IDE and Sloeber behave and will only link in the libraries needed out of the pool of possible libraries.
I have a project with two configurations, one for the ESP32 and one for the NodeMCU. The built in 8266 servo library works for that built, but I need to install this library for the ESP32... but when I do, then the NodeMCU config fails to build. I get: