PlatformIO Community

Wrong install by git link of lib without manifest

I try to add this repo to lib_deps as:

  • crcpp=https://github.com/d-bahr/CRCpp.git#master
  • crcpp=https://github.com/d-bahr/CRCpp/archive/master.zip

And so on… In all cases, pio install content of test/ folder instead of root, and that causes build errors (see .pio/<env>/crcpp/ content). Is that normal? If i copy sources to lib/ folder - build works as expected.

Is there any way to use original repo somehow, and include inc/CRC.h into my files (without original project changes)?

PS. Anyway, IMO, pio should not try to use test/ folder of dependencies for build.

Yes, see Include libraries from github - #2 by maxgerhardt and PlatformIO downloads subfolder - #4 by maxgerhardt. Since the linked library has no manifest file (library.json), PlatformIO crawls the subfolders in the search for the source folder, and finds source files in test/ in this case. This logic is contained in find_library_root(), and it fails for the folder structure of your target library.

Fixes as done to close e.g. https://github.com/platformio/platformio-core/issues/3887 is adding more special cases in the detection logic. In this case for e.g. per https://github.com/platformio/platformio-core/pull/4093.

The safest way to use a non-PlatformIO library within PlatformIO is to make it explicitly PlatformIO-compatible, that is, by forking it and giving it a library.json.

This has been fixed in the latest PlatformIO core 5.2.3 (https://github.com/platformio/platformio-core/releases, PR 4093).

1 Like