PlatformIO Community

Dependency error, what am i doing wrong?


#1

I am quite sure there is some config in my ini file wrong but i can’t figure out which

so i am trying to compile a skech that works on arduino ide

this is my ini file:

[platformio]
description = test
env_default = UNO ;
lib_extra_dirs = D:\cloud\Programmi\Arduino\libraries
src_dir = examples\GoProControl
lib_dir = src

[env:UNO]
framework = arduino
platform = atmelavr
board = uno

my folder structure:
├───.pioenvs
├───.vscode
├───examples
│ ├───ESP32_FreeRTOS
│ ├───GoProControl
│ └───MultiCam
├───extras
└───src

and the Dependency Graph:

|-- <GoProControl> 0.9.3 (D:\cloud\Programmi\Arduino\libraries\GoProControl)
|   |-- <ArduinoHttpClient> (D:\cloud\Programmi\Arduino\libraries\ArduinoHttpClient)
|   |-- <VidorPeripherals> 1.1.0 (D:\cloud\Programmi\Arduino\libraries\VidorPeripherals)
|   |   |-- <SPI> 1.0 (C:\Users\vincenzo\.platformio\packages\framework-arduinoavr\libraries\__cores__\arduino\SPI)
|   |-- <WiFi101> 0.15.3 (D:\cloud\Programmi\Arduino\libraries\WiFi101)
|   |   |-- <SPI> 1.0 (C:\Users\vincenzo\.platformio\packages\framework-arduinoavr\libraries\__cores__\arduino\SPI)
|   |-- <WiFiEsp> 2.2.2 (D:\cloud\Programmi\Arduino\libraries\WiFiEsp)
|   |-- <WiFiNINA> 1.3.0 (D:\cloud\Programmi\Arduino\libraries\WiFiNINA)
|   |   |-- <VidorPeripherals> 1.1.0 (D:\cloud\Programmi\Arduino\libraries\VidorPeripherals)
|   |   |   |-- <SPI> 1.0 (C:\Users\vincenzo\.platformio\packages\framework-arduinoavr\libraries\__cores__\arduino\SPI)
|   |   |-- <SPI> 1.0 (C:\Users\vincenzo\.platformio\packages\framework-arduinoavr\libraries\__cores__\arduino\SPI)

my header file is here: https://github.com/aster94/GoProControl/blob/master/src/GoProControl.h

as you can see the dependency grapf is wrong because it shouldn’t include all these library but only WiFiEsp instead it include ALL the library that i have in my header file without considering the #if defined()


#2

Does the same happen when lib_ldf_mode = deep+ (or chain+) is written into the platformio.ini? See https://docs.platformio.org/en/latest/librarymanager/ldf.html#ldf-mode and https://docs.platformio.org/en/latest/projectconf/section_env_library.html#lib-ldf-mode


#3

thanks man! both chan+ and deep+ solve it :sweat_smile:


#4

sorry i talked too early

the dependency graph are wrong, here include the libs twice:
first board:

Dependency Graph
|-- <GoProControl> 0.9.3 (D:\cloud\Programmi\Arduino\libraries\GoProControl)
|   |-- <WiFiEsp> 2.2.2 (D:\cloud\Programmi\Arduino\libraries\WiFiEsp)
|   |-- <ArduinoHttpClient> (D:\cloud\Programmi\Arduino\libraries\ArduinoHttpClient)
|-- <WiFiEsp> 2.2.2 (D:\cloud\Programmi\Arduino\libraries\WiFiEsp)
|-- <ArduinoHttpClient> (D:\cloud\Programmi\Arduino\libraries\ArduinoHttpClient)

second one:

Dependency Graph
|-- <GoProControl> 0.9.3 (D:\cloud\Programmi\Arduino\libraries\GoProControl)
|   |-- <ArduinoHttpClient> (D:\cloud\Programmi\Arduino\libraries\ArduinoHttpClient)
|   |-- <WiFi101> 0.15.3 (D:\cloud\Programmi\Arduino\libraries\WiFi101)
|   |   |-- <SPI> 1.0 (C:\Users\vincenzo\.platformio\packages\framework-arduinoespressif8266\libraries\SPI)
|   |-- <SPI> 1.0 (C:\Users\vincenzo\.platformio\packages\framework-arduinoespressif8266\libraries\SPI)
|   |-- <WiFiEsp> 2.2.2 (D:\cloud\Programmi\Arduino\libraries\WiFiEsp)
|   |-- <VidorPeripherals> 1.1.0 (D:\cloud\Programmi\Arduino\libraries\VidorPeripherals)
|   |   |-- <SPI> 1.0 (C:\Users\vincenzo\.platformio\packages\framework-arduinoespressif8266\libraries\SPI)
|   |-- <FreeRTOS> 9.0.0-1 (D:\cloud\Programmi\Arduino\libraries\FreeRTOS)
|   |-- <WiFiNINA> 1.3.0 (D:\cloud\Programmi\Arduino\libraries\WiFiNINA)
|   |   |-- <SPI> 1.0 (C:\Users\vincenzo\.platformio\packages\framework-arduinoespressif8266\libraries\SPI)
|   |-- <ESP8266WiFi> 1.0 (C:\Users\vincenzo\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi)
|   |   |-- <FreeRTOS> 9.0.0-1 (D:\cloud\Programmi\Arduino\libraries\FreeRTOS)
|-- <ArduinoHttpClient> (D:\cloud\Programmi\Arduino\libraries\ArduinoHttpClient)
|-- <WiFi101> 0.15.3 (D:\cloud\Programmi\Arduino\libraries\WiFi101)
|   |-- <SPI> 1.0 (C:\Users\vincenzo\.platformio\packages\framework-arduinoespressif8266\libraries\SPI)
|-- <SPI> 1.0 (C:\Users\vincenzo\.platformio\packages\framework-arduinoespressif8266\libraries\SPI)
|-- <WiFiEsp> 2.2.2 (D:\cloud\Programmi\Arduino\libraries\WiFiEsp)
|-- <VidorPeripherals> 1.1.0 (D:\cloud\Programmi\Arduino\libraries\VidorPeripherals)
|   |-- <SPI> 1.0 (C:\Users\vincenzo\.platformio\packages\framework-arduinoespressif8266\libraries\SPI)
|-- <FreeRTOS> 9.0.0-1 (D:\cloud\Programmi\Arduino\libraries\FreeRTOS)
|-- <WiFiNINA> 1.3.0 (D:\cloud\Programmi\Arduino\libraries\WiFiNINA)
|   |-- <SPI> 1.0 (C:\Users\vincenzo\.platformio\packages\framework-arduinoespressif8266\libraries\SPI)
|-- <ESP8266WiFi> 1.0 (C:\Users\vincenzo\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi)
|   |-- <FreeRTOS> 9.0.0-1 (D:\cloud\Programmi\Arduino\libraries\FreeRTOS)

ini file

[platformio]
description = test
env_default = UNO, ESP8266 ;UNO 101 ESP8266 ESP32
lib_extra_dirs = D:\cloud\Programmi\Arduino\libraries
src_dir = examples\GoProControl
lib_dir = src

[env:UNO]
framework = arduino
platform = atmelavr
board = uno
lib_ldf_mode = chain+

[env:ESP8266]
framework = arduino
platform = espressif8266
board = nodemcuv2
lib_ldf_mode = chain+

#5

LDF running amok oO?

Can you, for each environment, declare the actually necessary libraries in a lib_deps statement and the one PIO wrongly compiles in for the environment in lib_ignore? I know this is cumbersome but that’d be a workaround.

See https://docs.platformio.org/en/latest/projectconf/section_env_library.html#lib-deps

This is actually OK if the GoProControl library includes ArduinoHttpClient but some other main code (not located directly inside the GoProControl includes the library too… Or it’s a side-effect of the chain evaluation… But does it compile with the first environment though?


#6

This is actually OK if the GoProControl library includes ArduinoHttpClient but some other main code (not located directly inside the GoProControl includes the library too… Or it’s a side-effect of the chain evaluation… But does it compile with the first environment though?

the ArduinoHttpClient is called only once (only in GoProControl.h) but yes it compiles correctly but this brings me to think that the ini file is somewhat wrong!

I know this is cumbersome but that’d be a workaround

sure i can do it, but also i think that if this is the only way to do it how platformio include the liobrary should be modified!


#7

okkk with @maxgerhardt workaround works. But still I think (really i hope) that i am doing something wrong. Because if i am doing all correct platformio should try to fix this problem

I am not marked this as solved, even if Max was wonderful in helping me, because i would like that Ivan or someone for him see this problem

here there are my ini and compile logs
ini

[platformio]
description = test
env_default = UNO, ESP8266 ;UNO 101 ESP8266 ESP32
lib_extra_dirs = D:\cloud\Programmi\Arduino\libraries
src_dir = examples\GoProControl
;lib_dir = src

[env:UNO]
framework = arduino
platform = atmelavr
board = uno
lib_ldf_mode = chain+
lib_deps = WiFiEsp
lib_ignore =
  WiFi101
  WiFiNINA
  ESP8266WiFi
  VidorPeripherals
  FreeRTOS
  SPI

[env:ESP8266]
framework = arduino
platform = espressif8266
board = nodemcuv2
lib_ldf_mode = chain+
lib_deps = ESP8266WiFi
lib_ignore =
  WiFi101
  WiFiEsp
  WiFiNINA
  VidorPeripherals
  SPI
  FreeRTOS

esp:

CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 > NodeMCU 1.0 (ESP-12E Module)
HARDWARE: ESP8266 80MHz 80KB RAM (4MB Flash)
xtensa-lx106-elf-g++ -o "D:\cloud\Programmi\Arduino\libraries\GoProControl\examples\GoProControl\GoProControl.ino.cpp" -x c++ -fpreprocessed -dD -E "c:\users\vincenzo\appdata\local\temp\tmpkt44_s"
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain+) COMPATIBILITY(soft)
Ignored library D:\cloud\Programmi\Arduino\libraries\FreeRTOS
Ignored library D:\cloud\Programmi\Arduino\libraries\VidorPeripherals
Ignored library D:\cloud\Programmi\Arduino\libraries\WiFi101
Ignored library D:\cloud\Programmi\Arduino\libraries\WiFiEsp
Ignored library D:\cloud\Programmi\Arduino\libraries\WiFiNINA
Ignored library d:\cloud\Programmi\Arduino\libraries\GoProControl\.piolibdeps\WiFiEsp_ID509
Ignored library C:\Users\vincenzo\.platformio\packages\framework-arduinoespressif8266\libraries\SPI
Collected 74 compatible librariesM
ore details about "Library Compatibility Mode": https://docs.platformio.org/page/librarymanager/ldf.html#ldf-compat-modeScanning dependencies...

Dependency Graph
|-- <ESP8266WiFi> 1.0 (C:\Users\vincenzo\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi)
|-- <ArduinoHttpClient> (D:\cloud\Programmi\Arduino\libraries\ArduinoHttpClient)
|-- <GoProControl> 0.9.3 (D:\cloud\Programmi\Arduino\libraries\GoProControl)
|   |-- <ArduinoHttpClient> (D:\cloud\Programmi\Arduino\libraries\ArduinoHttpClient)
|   |-- <ESP8266WiFi> 1.0 (C:\Users\vincenzo\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi)

uno:

CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR > Arduino Uno
HARDWARE: ATMEGA328P 16MHz 2KB RAM (31.50KB Flash)
avr-g++ -o "D:\cloud\Programmi\Arduino\libraries\GoProControl\examples\GoProControl\GoProControl.ino.cpp" -x c++ -fpreprocessed -dD -E "c:\users\vincenzo\appdata\local\temp\tmpxfgnaa"
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain+) COMPATIBILITY(soft)
Ignored library D:\cloud\Programmi\Arduino\libraries\FreeRTOS
Ignored library D:\cloud\Programmi\Arduino\libraries\VidorPeripherals
Ignored library D:\cloud\Programmi\Arduino\libraries\WiFi101
Ignored library D:\cloud\Programmi\Arduino\libraries\WiFiNINA
Ignored library C:\Users\vincenzo\.platformio\packages\framework-arduinoavr\libraries\__cores__\arduino\SPI
Collected 74 compatible librariesMore details about "Library Compatibility Mode": https://docs.platformio.org/page/librarymanager/ldf.html#ldf-compat-mode

Scanning dependencies...
Dependency Graph
|-- <WiFiEsp> 2.2.2 (D:\cloud\Programmi\Arduino\libraries\WiFiEsp)
|-- <GoProControl> 0.9.3 (D:\cloud\Programmi\Arduino\libraries\GoProControl)
|   |-- <WiFiEsp> 2.2.2 (D:\cloud\Programmi\Arduino\libraries\WiFiEsp)
|   |-- <ArduinoHttpClient> (D:\cloud\Programmi\Arduino\libraries\ArduinoHttpClient)
|-- <ArduinoHttpClient> (D:\cloud\Programmi\Arduino\libraries\ArduinoHttpClient)

#8

Please file an issue under https://github.com/platformio/platformio-core/issues with a title like “LDF finds unrelated libraries” or something so that the devs can have a look :slight_smile: At least it works with a workaround :sweat_smile: I guess the LDF just looks for a header file name and the libs happen to use the same file names :confused:


#9

I will do it! thanks again :smiley:


#10

@maxgerhardt ivan said that this will be solved in pio 4.0 thanks