Duplicate library in .piolibdeps

My project depends on a Logging library via GitHub URL (GitHub - frankleonrose/Arduino-logging-library: easy to use logging library like log4j, log4net, ...). The same Logging library is listed as a dependency (in library.json) of another dependency (Respire/library.json at master · frankleonrose/Respire · GitHub).

After running, .piolibdeps contains both

  • Arduino Logging Library
  • Arduino Logging Library@src-1bbdf865e74caf45af3bb1f170c67c92

It used to have both “Arduino-logging-library” and “Arduino Logging Library”. I thought adding a library.properties would fix that, but it just changed it to this new situation.

I have looked in the forum and documentation and do not see an explanation.

Why are there two copies of the library? What is making the library manager think it needs a separate copy?


It happened to me some rare times, had you try to delete in your project the .piolibdeps hidden folder?

Yeah, it’s very stable. If I delete .piolibdeps it just rebuilds the directory with both copies of the dependency.

I ran pio run --verbose and see that it is something about installing the same library with two names.

Installing dependencies
LibraryManager: Installing Arduino Logging Library
Arduino Logging Library @ f5d5815 is already installed
LibraryManager: Installing arduino-logging-library
Arduino Logging Library @ f5d5815 is already installed

Looking further into the code in package.py (the only place where I found the string “@src-”) I see that it is resolving package identity looking at the version string (which makes sense). Looking more closely at my platformio.ini file and the library.json file of my dependency, I noticed that the git URL’s were different.

library.json has:

  "name": "Arduino Logging Library",
  "version": "https://github.com/frankleonrose/Arduino-logging-library.git",

whereas platformio.ini has

lib_deps = https://github.com/frankleonrose/Arduino-logging-library

I fixed the problem by adding “.git” to the URL in platformio.ini.