Importing a github library in a project


I created a Lilygo project.
Then in the plarformio.ini file I wrote:
#or using GIT Url (the latest development version)
lib_deps = GitHub - LilyGO/higrowopen

How do I import (fetch) the GitHub library in the project?



For custom libraries, I followed the guide here: pio lib install — PlatformIO latest documentation

More common libraries can easily be found from the PlatformIO home > Libraries.

1 Like

thanks @adambriankehl
I followed the guide and installed a repo from my own github account, the terminal said it was successful, however I do not see it in the installed tab of libraries section of pio.
Any ideas where I can see that it is installed, and potentially uninstall it?
I do seem to be able to include files from the repo in my projects, so I think it did install.

Is the library present in the .pio\libdeps\<environment> folder?

Also it’s kind of unusual to import them via the CLI (if you don’t need e.g. the global installation option that the CLI offers you), declaring the library’s git link in lib_deps should work as normal.

I don’t see a libdeps folder there. I think I might be looking in the wrong place.
I have attached a screenshot of the explorer window in VSC.
Did I mention I am using pio in vsc?

Ah, but is it in lib/?

Perhaps I should explain what I am trying to achieve. I have built up a bunch of projects with custom libraries, but now I want to consolidate all the libraries into one place, instead of having multiple copies and versions in each project.
The one I am starting with is b64.h - a simple base64 converter which is used inside my esp-OTA library. In the screenshot you will see I renamed b64.h to b64_local.h and then changed the include to the github version which is inside a folder (line 27). The intellisense finds this folder, so I am reasonably sure it is installed.
As you can see from the undefined reference error , the problem I now face is that the linker cannot find the definitions in the b64.cpp file.

The way you refer to the b64.h header file seems weird – shouldn’t you include b64_local.h? Also check the complete “Dependency Graph”, which can be seen just partially above the “Building in…” output. If b64_local-master is not included as a sub-dependency of esp32_OTA-master, you may need a more aggressive lib_ldf_mode mode, e.g. chain+.

1 Like

Oh I see the confusion. The file named b64_local.h was previously called b64.h
I am trying to create a global version of this library across all my projects, so I copied it to a global repo (synced with github) and installed the repo using the link in @adambriankehl 's post above.
Then I renamed the local version (I could have deleted it) to force the linker to find the global version.

Interestingly, after experimenting with a few values for lib_dirs and lib_extra_dirs in platformio.ini, and then removing them, I now have a .pio\libdeps\<environment> folder where there was not one before. Also, the project compiles successfully :tada:

Thanks for the link to the LDF documentation, I have learned something I was previously unaware of.

I am at a loss to explain why I did not previously have a .pio\libdeps\<environment> folder but comparing the 2 screenshots, it has definitely changed. Maybe it was re-initialized when I was experimenting in the platformio.ini file.