Library Manager downloads libraries, which are notrequired by the project

Hi, my very simple project for ESP8266 does include only Arduino.h. However, during build (pio run), Library Manager installs 2 libraries:

Processing esp01_1m_noFS_COMupload (platform: espressif8266; board: esp01_1m; framework: arduino)
-----------------------------------------------------------------------------------
Library Manager: Installing blynkkk/BlynkNcpDriver @ ^0.6.3
Unpacking  [####################################]  100%
Library Manager: BlynkNcpDriver@0.6.3 has been installed!
Library Manager: Installing paulstoffregen/OneWire @ ^2.3.5
Unpacking  [####################################]  100%
Library Manager: OneWire@2.3.8 has been installed!

Why is that?
My platformio.ini contains following:

[platformio]
description = blikání LED
name = blink
[env]
framework = arduino
upload_speed = 921600
monitor_speed = 115200
[env:esp01_1m_noFS_COMupload]
platform = espressif8266
board = esp01_1m
build_flags =
  -D FLASH_MAP_NO_FS
  -D PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK305
board_build.f_flash = 20000000L

Thanks for help.

All I can say, that’s not the cause (tested)

Can you share the whole project?

Yes, here is a link to Dropbox cloud with blink.zip:
https://www.dropbox.com/scl/fi/qppp66yde7ru98m754o4v/blink.zip?rlkey=k9sndf9uz5jc52kw3r0th5lw4&dl=0
Thank you.

After creating a src directory and moved main.cpp into that directory, the project compiled fine for both environments.

I’ve cleaned up the platformio.ini a bit.

The result is here: GitHub - sivar2311/blink

Well, thank you, but there was no problem in compiling itself. My project with previous platformio.ini and even with the main file blink.cpp placed in root of the project instead of /src has compiled very well (I have set the PLATFORMIO_SRC_DIR environment variable to project root, that is why no src subfolder is needed).
The problem relates to Library Manager, which downloads and stores BlynkNcpDriver and OneWire libraries into /.pio/libdeps, even if the blink.cpp does not require (include) them at all!
And this beahviour applies to your version of the project too!

Then someting’s wrong with your setup.

If you have PLATFORMIO_SRC_DIR set, this will apply to all your projects.

Remove this environment variable (and other variables you might have set) and check again.

Hi, sorry for the delay, but no change. But the issue is not related to the /src folder location. Even if I remove all environment variables or install a brand new VSCode portable, still the same result: Library Manager downloads and stores BlynkNcpDriver and OneWire libraries into /.pio/libdeps

Removing and reinstalling VS Code won’t help because this is related to PlatformIO, not VS-Code.

You’ll find the PlatformIO files in a folder .platformio.
On Windows this is located in C:\Users\<username>\

  • Close VS Code
  • delete all your custom platformio related environtment variables
  • Delete the “.platformio” folder
  • Restart VS Code
  • PlatformIO will reinstall - wait until it is finished
  • Try again

I have tried to delete all files in .platformio folder more times already. The result is still the same.
My idea is, that downloading the 2 libraries by Library Manager is somehow related to what ESP8266 core requires…

It does not download those libraries for me

And the core does not depend to those libraries at all…

Please double check that there are no “PLATFORMIO_xxxx” environment variables set

OK, I will double check and try again…

Well, it is clear now: The described behaviour is caused by setting the PLATFORMIO_LIB_DIR environment variable. Without it, no libdeps are downloaded by Library Manager.
I wanted to use the PLATFORMIO_LIB_DIR environment variable to tell Platformio, where is the folder, where all Arduino related libraries, even my own custom libraries, are stored.
For example, I have a Utils.h library to be used accross all my IoT projects for any platform or board. Another example is Blynk.h etc. I know, however, that such a sharing of libraries is againts Platformio startegy…
Is there any other way to tell Platformio, where all my libraries are? Another reason is, that I share the libraries with Arduino CLI installation, which is used only as a backup or from legacy purposes.
Thanks fo help.

Well that’s the wrong approach!

I know, however, that such a sharing of libraries is againts Platformio startegy…

For a good reason - as you have found out :wink:

But you can use symlink instead to have some similiar but working behavior.

lib_deps = 
  symlink://path-to-Utils.h
  symlink://path-to-Blink.h

Take a look at this post:

If you have a folder strukture like this:

.
├── libraries
│   ├── LibA
│   ├── LibB
│   └── LibC
└── projects
    ├── ProjectA
    ├── ProjectB
    └── ProjectC

Then you can use relative symlinks.

Example:

Project-B depends on LibA and LibC
platformio.ini of ProjectB:

lib_deps = 
  symlink://../../libraries/LibA
  symlink://../../libraries/LibB

This ensures that only LibA and LibB are used to build ProjectB but not every library in the libraries folder.

OK, thanks, will try.
Thanks for expleining it to me.

Well, not sure, what is wrong, but this does not work in platformio.ini:

[common]
lib_deps =
  symlink:D:/Arduino/libraries/_MiB/Utils.h

Not even this:
Utils = symlink:D:/Arduino/libraries/_MiB/Utils.h
nor this:
symlink://Arduino/libraries/_MiB/Utils.h

What about this one?

symlink://D:/Arduino/libraries/_MiB

The _MiB folder should contain a valid library including a library.json manifest. See Creating Library — PlatformIO latest documentation

I start to feel realy crazy or stupid :slight_smile:
This is the line in platformio.ini:
symlink://D:/Dropbox/Arduino/sketch/libraries/_MiB
And here is the library.json:

{
    "name": "MiB",
    "version": "1.0.0",
    "description": "Moje veci",
    "keywords": "esp8266",
    "repository": {
        "type": "git",
        "url": "https://gitlab.com/milanbx/arduino-libs.git"
    },
    "authors": [
        {
            "name": "MIlan Brabec",
            "email": "milan.brabec@centrum.cz",
            "url": "https://www.linkedin.com/in/mildabrabec"
        }
    ],
    "license": "MIT",
    "homepage": "https://gitlab.com/milanbx/arduino-libs",
    "frameworks": "*",
    "platforms": "*"
}

Still, the Utils.h is not recognised, even if it is placed in .../_MiB/include/

Utils.h is part of this MiB library?
Sorry, but I don’t know this library and https://gitlab.com/milanbx/arduino-libs shows 404…

Yes, Utils.h is a file in .../_MiB/includes and the repo is private, thus not visible to you. But it should not matter, as I try to point Platformio to a local file.

I mean, is it really so complicated to include my local *.h file into my project and share it with my other projects in Platformio?
It is a bit frustrating to me, when I need to bother you with such a basics…
And no docs helped so far either.
Sorry, for that.