Unable to install library to global storage via GUI

Hi,

I don’t seem to have an option to install a library to global storage from the GUI. The only option I get is ‘Add to project’.
CLI “pio lib -g install xxxx” will install the library to global storage correctly.

Am I missing something? This was never an issue before.

I’m using VSCode 1.49.2 on Win7, PIO extension 2.1.0, PIO core 5.0.1. (As far as I know all the latest versions.)

Thanks,
Zoltan

2 Likes

I believe that option was removed in release 2.0.0. Someone else mentioned it at PlatformIO IDE 2.0 for VSCode 🚀 - #11 by juha.meriluoto.

Cheers,
Norm.

Thank you! Looks like I haven’t tried to install a library since the 2.0.0 upgrade.

1 Like
2 Likes

OMG - its true :frowning: Was looking for hours what is going wrong here.
I desperately need global installation.

“pio lib -g install" works so far.

After fresh installation or after downloading a project from the internet I also have to add all projects to “homestate.json” for “add to project” is able to find them.

I have some libraries that I’m working on. They live in separate directories under my platformio_libraries folder.

In platformio.ini I have:

lib_extra_dirs = /path/to/platformio_libraries

When I compile a project, it can find whichever of my “global” libraries that I’m using. Plus, I don’t need to specify any library names in lib_deps!

It’s not the old global library feature, but it works fine for me.

HTH

Cheers,
Norm.

1 Like

It was a nice feature browsing through the registry, Installing some stuff, applying my patches ONCE (there is almost no lib I did not customize :slight_smile: ) and use it for all projects.
That’s a lot more “copy from here to there” now and change the dependencies after moved.

I’m not following you, sorry.

Global libraries are a bit before my time with PlatformIO, but were, I understand, installed into a common (global) location.

I imagine that when used in a project, they were copied over into the project as per non-global libraries.

I use my platformio_libraries top level folder for my own “globals” and they are added to projects as detailed above. They are global, just not as global as perhaps they may once have been. :wink:

HTH

Cheers,
Norm.

No, the code itself was not copied but the resulting object-code kept in Project-Cache. So every change on the library was automatically applied when recompiling one of the projects.
That’s quite useful when working more on the libraries than on a project. I do like this when porting to other platforms or frameworks.
maybe this is not up-to-date-straight-forward-development but hey, I am an old man and quite used doing things like I ever did.
And it always is sad when upgrades made life more difficult for me.

1 Like

Aha! Thanks. So your source code stayed where it was, in the global folder, and was not copied into the project. Any changes you made to the library source code, were propagated to the binary version linked into the project when the project itself was recompiled?

If this is the case, then my setup for my pseudo-global libraries does the same thing – I just tested it to be 100% certain. I did the following:

  • Edited a function in my AVRusart library which lives in platformio_libraries/AVRusart which is my own “Serial” interface look-alike library;
  • Compiled a project which uses AVRusart by defining the following in platformio.ini: lib_extra_dirs = /path/to/platformio_libraries
  • Changes appeared in the uploaded code;
  • No source code for the library was copied to the project directories, only object files *.o and a static library libAVRusart.a.

So, in summary:

  • Keep your downloaded and modified libraries in separate folders beneath a top-level globals folder;
  • Add the path (relative or full) to the top-level folder to any project that needs a library you have written or downloaded;
  • Do not mention any of those libraries in lib_deps;
  • Add the appropriate header files to #include "whatever.h" statements when libraries are required;
  • Compile, upload and have fun!

It seems to work the way you would want it to work by doing this.

Me too - but sometimes the world moves out from underneath you! It seems that global libraries caused too many problems with same named libraries being written for different platforms/frameworks and the wrong libraries being linked by the linker.

HTH

Cheers,
Norm.

1 Like

Yes, your setup does the same. This will work of course.
It just was nice browsing and scrolling through all that libraries and install this and that. That’s a little more complicated now (find the exact name first and copy to CLI) - The folder in old “lib” were parsed for compatibility with platform and framework. Do not know yet if this also works for external lib paths.

Maybe they bring back the old feature? :slight_smile:
That “Add to project” does not work at all when working with different project-trees or more than one compiler installation on different machines because projects not created with that installation are not listed in that “add to project” list. I manually had to edit that “homestate.json” file to add all the projects for the mounted drive. So that’s not exactly “cool”

3 Likes

As I do not want to open a new post for this:
+1 for bringning back the button
Sadly, since 2.0 update, for me PIO is less intuitive and user-friendly. Now I have to add a .txt to the desktop with the command to add a library to all projects for the case I need a new one in a few months. Makes no sense for me. What will 3.0 bring - remove UI and back to terminal-usage at all?^^

3 Likes

Yep. I’m on team bring back the option for global libraries in the GUI again.

I use the same libraries in hundreds of projects… updating each one one by one is a royal PITA.
The old way worked, and if i wanted to be using the command line to do it… I wouldn’t be using a GUI!

3 Likes

+1 give an option to install libraries globally

1 Like

I would also like to see the option to install libraries globally returned. That is often the point of libraries - global code that can be used by multiple projects.

pio lib --global install <your library here> (docs) is still there if you want it.

Thank you for the reply. I’ll give that a try.

It would still be nice to have the ability to add global libraries through the GUI someday (again?). But this could certainly help. Thank you for taking the time to reply!