question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot use shared library storage with lib_deps

See original GitHub issue

Configuration

Operating system: Linux

PlatformIO Version (platformio --version): PlatformIO, version 4.0.0b2

Description of problem

Having a project with multiple environments that re-use same lib_deps variable, I encountered a confusing behaviour with global library storage:

  1. Global library storage is ignored with specific versions from lib_deps variable (library @ version or github links)
  2. It is seemingly impossible to specify shared library storage for multiple environments. libdeps_dir is following new rules for workspace_dir, forcing each environment to create a subdirectory {libdeps_dir}/{env}/…library…

Steps to Reproduce

The content of platformio.ini:

[env:a]
platform = espressif32
board = lolin32
framework = arduino
lib_deps =
    ArduinoJson@5.13.4

[env:b]
platform = espressif32
board = lolin32
framework = arduino
lib_deps =
    ArduinoJson

The content of src/dummy.cpp

#include <Arduino.h>
void setup() {}
void loop() {}
$ pio lib -g install ArduinoJson@5.13.4
Library Storage: /home/builder/.platformio/lib
Looking for ArduinoJson library in registry
Found: https://platformio.org/lib/show/64/ArduinoJson
LibraryManager: Installing id=64 @ 5.13.4
Using cache: /home/builder/.platformio/.cache/7e/ba586a56b4024a92728654afd0862c7e
Unpacking  [####################################]  100%
ArduinoJson @ 5.13.4 has been successfully installed!

$ pio run -e a
Processing a (platform: espressif32; board: lolin32; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/lolin32.html
PLATFORM: Espressif 32 1.8.0 > WEMOS LOLIN32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: toolchain-xtensa32 2.50200.80 (5.2.0), framework-arduinoespressif32 2.10002.190416 (1.0.2), tool-esptoolpy 1.20600.0 (2.6.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Looking for ArduinoJson library in registry
Found: https://platformio.org/lib/show/64/ArduinoJson
LibraryManager: Installing id=64 @ 5.13.4
Using cache: /home/builder/.platformio/.cache/7e/ba586a56b4024a92728654afd0862c7e
Unpacking  [####################################]  100%
ArduinoJson @ 5.13.4 has been successfully installed!
Found 58 compatible libraries
Scanning dependencies...
^CBuild interrupted.

$ pio run -e b
Processing b (platform: espressif32; board: lolin32; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/lolin32.html
PLATFORM: Espressif 32 1.8.0 > WEMOS LOLIN32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: toolchain-xtensa32 2.50200.80 (5.2.0), framework-arduinoespressif32 2.10002.190416 (1.0.2), tool-esptoolpy 1.20600.0 (2.6.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 57 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ArduinoJson> 5.13.4
^CBuild interrupted.

Examining libdeps contents:

$ ls .pio/libdeps/*
.pio/libdeps/a:
ArduinoJson_ID64

.pio/libdeps/b:

I have also tried adding [env:...] lib_extra_dirs = ./my_shared_libs and installing the library there.

Actual Results

lib_deps = … library gets installed in the .pio/libdeps/env/… despite being in the global storage

Expected Results

Library presence is checked in global or lib_extra storage dir before installing it in the {workspace_dir}/libdeps storage. Which I think I solved locally for me via mcspr@c231535e

It would also be extremely useful to still be able to use pio run -e ... with old-style .piolibdeps storage when there is no practical reason of having multiple copies of the same library in .pio/libdeps/…/library For example, when environments only differ in src_build_flags values or without internet connection present. I wonder if this can be solved by making default libdeps_dir actually reference that it uses current environment as a part of the path (e.g {workspace_dir}/libdeps/{pioenv})?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ivankravetscommented, Jun 29, 2019

I like your implementation! Let keep this in mind when someone will ask. We don’t want to support different workflows in official docs. It will help us to save resources when developers will have any issues.

Extra scripting was specially created for these cases when you don’t like default PlatformIO Core behavior. So, everyone can tune it for own needs.

1reaction
mcsprcommented, Jun 28, 2019

BTW, I did try extra script just now. Mini template project with subprocess and LibraryManager (probably OK too?) https://gist.github.com/mcspr/80829350513faf37d3154ab67c40ae8b Do you think this can be added to the extra_scripts examples? Being both an example of the GetProjectOption (which I did not notice before!) and general library management.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use iCloud Shared Photo Library - Apple Support
If the library creator runs out of iCloud storage, content can no longer be added to the Shared Library and changes such as...
Read more >
Library and Drive Sharing Across CommCells - Online Help
Use this dialog box to setup Library Server which allow you to share library across CommCells. Select CommCell. Displays the option to register ......
Read more >
c++ - Linux - cannot find shared library - Stack Overflow
"error while loading shared libraries: libdvbv5.so.0: cannot open shared object file: No such file or directory". Well, the library appears to be there....
Read more >
alterad: error while loading shared libraries: libiberty.so - Intel
To work around this problem, modify the LD_LIBRARY_PATH environment variable to include the appropriate platform directory in your Quartus® II software ...
Read more >
View Shared Libraries in Microsoft OneDrive at IU
Note: If you cannot see More libraries, this may mean that either you do not have access to enough Shared Libraries to see...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found