PlatformIO Community

"FATAL ERROR: No such file" from library.json "dependencies"

Hello.

My first attempt at a Project Configuration File has crashed and burned.

I’ve created a library in a git repository. I install that from platformio.ini thus:

lib_deps = https://github.com/kingswood-monitor/kwNodeKit.git

In .pio/libdeps/..../kwNodeKit/library.json, I specify dependencies thus:

"dependencies": {
    "nanopb": "https://github.com/nanopb/nanopb.git",
    etc.

and

"build": {
    "flags": [
        "-I src/proto"
    ]
}

src/proto contains packet.pb.h and kwNodeKit/Nanopb contains ph.h.

When I build, I get error: .pio/libdeps/ttgo-lora32-v1/kwNodeKit/src/proto/packet.pb.h:6:16: fatal error: pb.h: No such file or directory

I would have expected that specifying the required library dependencies, and telling it to look in proto for headers, would work but clearly something has gone amiss. Probably in my understanding.

Can anyone advise how to wire this tangle up using the correct library.json directives? Thank you in advance.

I only see pb.h in https://github.com/nanopb/nanopb. Typo?

I don’t see that in your current repo:

There, you are missing the

 "-I src/protobuf-packet"

entry where the packet.pb.h is stored.

Where does this util.h come from? I don’t see it in the library or dependencies.

As a hack, I can get the example to compile with

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps = 
    https://github.com/kingswood-monitor/kwNodeKit.git
    https://github.com/nanopb/nanopb.git
    https://github.com/markruys/arduino-DHT.git
    https://github.com/closedcube/ClosedCube_HDC1080_Arduino.git
    https://github.com/tedyapo/arduino-VEML7700.git
    https://github.com/kingswood-monitor/RadioHead.git
    https://github.com/sandeepmistry/arduino-LoRa.git
    SPI
    Wire
build_flags =
    -D LED_BUILTIN=2
#include <Arduino.h>
/**
 * simpleNode.cpp
 * 
 * Example of a simple NodeKit node with a DH22 temperature and humidity sensor
 * and LoRa transport.
 * 
 * Transmits temperature and humidity every second to a receiver.
 */

#include <kwNode.h>
#include <kwDHT22.h>
#include <kwLoraSM.h>

#include <packet.pb.h>
//#include <util.h>

#define LOCATION NodeLocation_greenhouse
#define TYPE NodeType_environment
#define CHIPID 123
#define FIRMWARE_VERSION "1.0.0"

#define DH22_DATA_PIN 16

// create the node
kwNode node(LOCATION, TYPE, CHIPID, FIRMWARE_VERSION);

// create the transport
kwLoraSM lora;

// creste the sensor
kwDHT22 *pDHT22 = new kwDHT22(DH22_DATA_PIN);

void setup()
{
    node.addSensor(pDHT22);
    node.addTransport(&lora);
    node.start();
}

uint16_t packetID = 0;
uint8_t packetBuffer[255] = {0};

void loop()
{
    if (/*runEvery(1000)*/ true)
    {
        uint8_t bytesWritten = node.readAndEncodeMeasurements(packetID++, packetBuffer, true);
        lora.sendPacket(packetBuffer, bytesWritten);
    }
}

but it’s of course a hack.

Max - thanks for looking at this for me. It looks like I have two problems, one of which I fixed:

  1. I missed "-I src/protobuf-packet" from the build flags
  2. One of the libraries is installing to a directory with a space in the name ("ClosedCube HDC1080"), and that seems to be confusing the parser.

I’ve fixed (2) for now by adding the same library in platformio.ini lib_deps:

lib_deps = 
    https://github.com/kingswood-monitor/kwNodeKit.git
    https://github.com/closedcube/ClosedCube_HDC1080_Arduino.git

but that means an extra step when installing the library which I don’t want.

Is there a way of handling libraries with spaces in their names in library.json files?

Thanks

How did you deduce that a space is the problem? What does it cause?

Most interestingly when I put only

lib_deps = 
    https://github.com/kingswood-monitor/kwNodeKit.git

in the platformio.ini, upon building, it does not install the library’s dependencies. But as the docs say, when using pio lib install in the project’s folder:

playground>pio lib install "https://github.com/kingswood-monitor/kwNodeKit.git"
Library Storage: C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev
LibraryManager: Installing kwNodeKit
git version 2.16.2.windows.1
Cloning into 'C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\_tmp_installing-2x4366kw-package'...
remote: Enumerating objects: 36, done.
remote: Counting objects: 100% (36/36), done.
remote: Compressing objects: 100% (28/28), done.
remote: Total 36 (delta 5), reused 30 (delta 5), pack-reused 0
Unpacking objects: 100% (36/36), done.
kwNodeKit @ 51b29e5 has been successfully installed!
Installing dependencies
LibraryManager: Installing nanopb
git version 2.16.2.windows.1
Cloning into 'C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\_tmp_installing-155kt5wc-package'...
remote: Enumerating objects: 522, done.
remote: Counting objects: 100% (522/522), done.
remote: Compressing objects: 100% (469/469), done.
remote: Total 522 (delta 50), reused 303 (delta 25), pack-reused 0
Receiving objects: 100% (522/522), 897.88 KiB | 1.47 MiB/s, done.
Resolving deltas: 100% (50/50), done.
Nanopb @ 0f3dbba has been successfully installed!
LibraryManager: Installing arduino-DHT
git version 2.16.2.windows.1
Cloning into 'C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\_tmp_installing-8zog_hjo-package'...
remote: Enumerating objects: 11, done.
remote: Counting objects: 100% (11/11), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 11 (delta 0), reused 5 (delta 0), pack-reused 0
Unpacking objects: 100% (11/11), done.
arduino-DHT @ cd24ce3 has been successfully installed!
LibraryManager: Installing ClosedCube_HDC1080_Arduino
git version 2.16.2.windows.1
Cloning into 'C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\_tmp_installing-f5ej5gzm-package'...
remote: Enumerating objects: 19, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 19 (delta 3), reused 10 (delta 0), pack-reused 0
Unpacking objects: 100% (19/19), done.
ClosedCube HDC1080 @ 29ff3e3 has been successfully installed!
LibraryManager: Installing arduino-VEML7700
git version 2.16.2.windows.1
Cloning into 'C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\_tmp_installing-bs5a9388-package'...
remote: Enumerating objects: 14, done.
remote: Counting objects: 100% (14/14), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 14 (delta 2), reused 11 (delta 1), pack-reused 0
Unpacking objects: 100% (14/14), done.
arduino-VEML7700 @ 638fa8c has been successfully installed!
LibraryManager: Installing RadioHead
git version 2.16.2.windows.1
Cloning into 'C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\_tmp_installing-5g1fenq4-package'...
remote: Enumerating objects: 94, done.
remote: Counting objects: 100% (94/94), done.
remote: Compressing objects: 100% (75/75), done.
remote: Total 94 (delta 17), reused 94 (delta 17), pack-reused 0
Unpacking objects: 100% (94/94), done.
RadioHead @ f8ce4b3 has been successfully installed!
LibraryManager: Installing arduino-LoRa
git version 2.16.2.windows.1
Cloning into 'C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\_tmp_installing-62edcw9q-package'...
remote: Enumerating objects: 37, done.
remote: Counting objects: 100% (37/37), done.
remote: Compressing objects: 100% (28/28), done.
remote: Total 37 (delta 5), reused 21 (delta 1), pack-reused 0
Unpacking objects: 100% (37/37), done.
LoRa @ 7edf89a has been successfully installed!
Looking for Wire library in registry
Warning! Library `{'name': 'Wire', 'version': '>0'}` has not been found in PlatformIO Registry.
You can ignore this message, if `{'name': 'Wire', 'version': '>0'}` is a built-in library (included in framework, SDK). E.g., SPI, Wire, etc.
Looking for SPI library in registry
Warning! Library `{'name': 'SPI', 'version': '>0'}` has not been found in PlatformIO Registry.
You can ignore this message, if `{'name': 'SPI', 'version': '>0'}` is a built-in library (included in framework, SDK). E.g., SPI, Wire, etc.

It does go through all libraries, lol.

Why would only the pio lib install command install dependencies but not do that when it’s just put into a lib_deps directive? @valeros?

Okay I see what you mean. When installing it via pio lib install it creates a folder .pio\libdeps\esp32dev\ClosedCube HDC1080 and it fails to find the header ClosedCube_HDC1080.h. But that’s not because the of the space but it’s missing from the dependency tree

Dependency Graph
|-- <kwNodeKit> 0.1.0 #51b29e5 [git+https://github.com/kingswood-monitor/kwNodeKit.git] (C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\kwNodeKit)
|   |-- <arduino-DHT> #cd24ce3 [git+https://github.com/markruys/arduino-DHT.git] (C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\arduino-DHT)
|   |-- <arduino-VEML7700> #638fa8c [git+https://github.com/tedyapo/arduino-VEML7700.git] (C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\arduino-VEML7700)
|   |   |-- <Wire> 1.0.1 (C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\libraries\Wire)
|   |-- <RadioHead> #f8ce4b3 [git+https://github.com/kingswood-monitor/RadioHead.git] (C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\RadioHead)
|   |   |-- <SPI> 1.0 (C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\libraries\SPI)
|   |-- <Wire> 1.0.1 (C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\libraries\Wire)
|   |-- <SPI> 1.0 (C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\libraries\SPI)
|   |-- <Nanopb> 0.4.1 #0f3dbba [git+https://github.com/nanopb/nanopb.git] (C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\Nanopb)
|   |-- <LoRa> 0.7.2 #7edf89a [git+https://github.com/sandeepmistry/arduino-LoRa.git] (C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\LoRa)
|   |   |-- <SPI> 1.0 (C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\libraries\SPI)
|-- <SPI> 1.0 (C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\libraries\SPI)
|-- <Wire> 1.0.1 (C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\libraries\Wire)

no ClosedCube HDC1080 entry there. Not even with lib_ldf_mode = chain+.

Edit: Also noticed that it says

Warning: Ignored `nanopb` dependency for `kwNodeKit` library
Warning: Ignored `ClosedCube_HDC1080_Arduino` dependency for `kwNodeKit` library
Warning: Ignored `arduino-LoRa` dependency for `kwNodeKit` library

in the output. But why is it ignored?

Oh COME on. I think I found it.

You must reference the actual library name, which the library declares in the name field of its library.json / library.properties. Otherwise PIO will not respect it as valid.

Changing it to

    "dependencies": {
        "Nanopb": "https://github.com/nanopb/nanopb.git",
        "arduino-DHT": "https://github.com/markruys/arduino-DHT.git",
        "ClosedCube HDC1080": "https://github.com/closedcube/ClosedCube_HDC1080_Arduino.git",
        "arduino-VEML7700": "https://github.com/tedyapo/arduino-VEML7700.git",
        "RadioHead": "https://github.com/kingswood-monitor/RadioHead.git",
        "LoRa": "https://github.com/sandeepmistry/arduino-LoRa.git",
        "Wire": ">0",
        "SPI": ">0"
    },

makes the dependcy graph look much, much better.

Dependency Graph
|-- <kwNodeKit> 0.1.0 #51b29e5 [git+https://github.com/kingswood-monitor/kwNodeKit.git] (C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\kwNodeKit)
|   |-- <Nanopb> 0.4.1 #0f3dbba [git+https://github.com/nanopb/nanopb.git] (C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\Nanopb)
|   |-- <arduino-DHT> #cd24ce3 [git+https://github.com/markruys/arduino-DHT.git] (C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\arduino-DHT)
|   |-- <ClosedCube HDC1080> 1.3.2 #29ff3e3 [git+https://github.com/closedcube/ClosedCube_HDC1080_Arduino.git] (C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\ClosedCube HDC1080)
|   |   |-- <Wire> 1.0.1 (C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\libraries\Wire)
|   |-- <arduino-VEML7700> #638fa8c [git+https://github.com/tedyapo/arduino-VEML7700.git] (C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\arduino-VEML7700)
|   |   |-- <Wire> 1.0.1 (C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\libraries\Wire)
|   |-- <RadioHead> #f8ce4b3 [git+https://github.com/kingswood-monitor/RadioHead.git] (C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\RadioHead)
|   |-- <LoRa> 0.7.2 #7edf89a [git+https://github.com/sandeepmistry/arduino-LoRa.git] (C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\LoRa)
|   |   |-- <SPI> 1.0 (C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\libraries\SPI)
|   |-- <Wire> 1.0.1 (C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\libraries\Wire)
|   |-- <SPI> 1.0 (C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\libraries\SPI)
|-- <SPI> 1.0 (C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\libraries\SPI)
|-- <Wire> 1.0.1 (C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\libraries\Wire)
|-- <Nanopb> 0.4.1 #0f3dbba [git+https://github.com/nanopb/nanopb.git] (C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\Nanopb)
|-- <arduino-DHT> #cd24ce3 [git+https://github.com/markruys/arduino-DHT.git] (C:\Users\Maxi\Desktop\Programming_stuff\playground\.pio\libdeps\esp32dev\arduino-DHT)

and it builds with just lib_deps = https://github.com/kingswood-monitor/kwNodeKit.git for me :).

Quite brilliant. Well done! I would not have guessed that and now it works perfectly. Thank you again for looking into this for me, I appreciate it and have learned something.