Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot upgrade platformio lib to pio pkg to install library EspSoftwareSerial #4410

Closed
Erriez opened this issue Sep 4, 2022 · 6 comments
Closed

Comments

@Erriez
Copy link

Erriez commented Sep 4, 2022

Configuration

Operating system: Ubuntu 22.04

PlatformIO Version: PlatformIO Core, version 6.1.4

Description of problem

I'm porting CI build scripts from legacy platformio lib to pio pkg install, but does not work for a specific library.

Background: The developer of library [email protected] introduced a filename conflict src/SoftwareSerial.[c|h] as this library can only be used for ESP targets, not AVR. For this reason, it cannot be installed globally. A workaround was to install this library directly in the ESP libraries framework directory: .platformio/packages/framework-arduinoespressif32/libraries/EspSoftwareSerial/.

Legacy code (worked):

$ platformio lib --storage-dir ~/.platformio/packages/framework-arduinoespressif32/libraries install "[email protected]"

Install ESPSoftwareSerial into framework-arduinoespressif32 to prevent conflicts with generic name SoftwareSerial

WARNING: This command is deprecated and will be removed in the next releases. 
Please use `pio pkg install` instead.

Library Manager: Installing EspSoftwareSerial @ 6.16.1
Unpacking  [####################################]  100%
Library Manager: [email protected] has been installed!

New code (does not work):

$ pio pkg install --storage-dir ~/.platformio/packages/framework-arduinoespressif32/libraries --library "[email protected]"

Error: Not a PlatformIO project. `platformio.ini` file has not been found in current working directory
(/home/user/Arduino/libraries/ErriezLibrary). 
To initialize new project please use `platformio project init` command

Steps to Reproduce

Execute the commands above.

If problems with PlatformIO Build System:

The content of platformio.ini:
Not applicable, building directly an Arduino IDE sketch from the commandline.

Source file to reproduce issue:
See above.

Any suggestions how to proceed?

@maxgerhardt
Copy link
Contributor

$ pio pkg install --storage-dir ~/.platformio/packages/framework-arduinoespressif32/libraries --library "[email protected]"

As pio pkg install -h says

Usage: pio pkg install [OPTIONS]

Options:
  -d, --project-dir DIRECTORY
  -e, --environment TEXT
  -p, --platform SPECIFICATION
  -t, --tool SPECIFICATION
  -l, --library SPECIFICATION
  --no-save                     Prevent saving specified packages to
                                `platformio.ini`
  --skip-dependencies           Skip package dependencies
  -g, --global                  Install package globally
  --storage-dir DIRECTORY       Custom Package Manager storage for global
                                packages
  -f, --force                   Reinstall package if it exists
  -s, --silent                  Suppress progress reporting
  -h, --help                    Show this message and exit.

so you should be using

pio pkg install --global --storage-dir ~/.platformio/packages/framework-arduinoespressif32/libraries --library "[email protected]"

as the command instead.

@Erriez
Copy link
Author

Erriez commented Sep 7, 2022

Thanks @maxgerhardt for pointing to this package installation command. This solved my problem.

A combination of options --storage-dir and --global is required and I was not aware of this.

@maxgerhardt
Copy link
Contributor

maxgerhardt commented Sep 7, 2022

I guess if the pio pkg install command wants to remain backwards compaibilitiy to pio lib install, it should auto-enable --global when --storage-dir is given.

@ivankravets
Copy link
Member

Yes, @maxgerhardt, I marked this issue as a bug. We will fix it.

@ivankravets
Copy link
Member

Please re-rest with the latest PlatformIO Core using pio upgrade --dev. Thanks.

@Erriez
Copy link
Author

Erriez commented Oct 1, 2022

@ivankravets The pio upgrade --dev works with the command pio pkg install --storage-dir ~/.platformio/packages/framework-arduinoespressif32/libraries --library "[email protected]".

Thanks for your support. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants