Firebase library add issue arduino mobitz

Hi

I tried added mobitz firebase library but i cant.
Always gives error in Arduino framework.
platform ini:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps = mobizt/Firebase ESP32 Client@^4.0.0

monitor_speed = 115200

error:

 #include <SPIFFS.h>
          ^~~~~~~~~~
compilation terminated.
*** [.pio\build\esp32dev\lib468\Firebase ESP32 Client\signer\Signer.cpp.o] Error 1
*** [.pio\build\esp32dev\lib468\Firebase ESP32 Client\rtdb\QueryFilter.cpp.o] Error 1
In file included from .pio/libdeps/esp32dev/Firebase ESP32 Client/src/session/FB_Session.cpp:33:
.pio/libdeps/esp32dev/Firebase ESP32 Client/src/FirebaseFS.h:26:10: fatal error: SPIFFS.h: No such file or directory

****************************************************************
* Looking for SPIFFS.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:SPIFFS.h"
* Web  > https://registry.platformio.org/search?q=header:SPIFFS.h
*
****************************************************************

 #include <SPIFFS.h>
          ^~~~~~~~~~
compilation terminated.
*** [.pio\build\esp32dev\lib468\Firebase ESP32 Client\session\FB_Session.cpp.o] Error 1
In file included from .pio/libdeps/esp32dev/Firebase ESP32 Client/src/FB_Net.h:10,
                 from .pio/libdeps/esp32dev/Firebase ESP32 Client/src/wcs/esp32/FB_TCP_Client.h:36,
                 from .pio/libdeps/esp32dev/Firebase ESP32 Client/src/wcs/esp32/FB_TCP_Client.cpp:36:
.pio/libdeps/esp32dev/Firebase ESP32 Client/src/FirebaseFS.h:26:10: fatal error: SPIFFS.h: No such file or directory

****************************************************************
* Looking for SPIFFS.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:SPIFFS.h"
* Web  > https://registry.platformio.org/search?q=header:SPIFFS.h
*
****************************************************************

 #include <SPIFFS.h>
          ^~~~~~~~~~
compilation terminated.
*** [.pio\build\esp32dev\lib468\Firebase ESP32 Client\wcs\esp32\FB_TCP_Client.cpp.o] Error 1

Since the library uses conditional macros for including the sub-libraries

you have to set lib_ldf_mode accordingly in the platformio.ini, e.g.,

lib_ldf_mode = chain+
1 Like

Solution " ```
lib_ldf_mode = chain+

Not working

This morning, I have exactly the same error. I have two files built from the same codebase. One will build successfully the other will not due to the missing SPIFFS.h dependency. I’m confused by why this should happen all of a sudden and only to one of my sketches. The previous solution ‘lib_ldf_mode = chain+’ does not resolve the issue. Are there any alternative solutions? Thanks

Please post a minimal project that reproduces the problem.

My apologies for not supplying the sketch code. Here is the Firebase rtdb sketch I am using to upload data:

#include <Arduino.h>
#include <WiFi.h>

#include <FirebaseESP32.h>
#include <addons/TokenHelper.h>
#include <addons/RTDBHelper.h>

#define WIFI_SSID "______"
#define WIFI_PASSWORD "______"
#define API_KEY "______"

#define USER_EMAIL "______@gmail.com"
#define USER_PASSWORD "______"
#define DATABASE_URL "https://coilwinder-rtdb-default-______"

FirebaseData fbdo;
FirebaseAuth auth;
FirebaseConfig config;

unsigned long sendDataPrevMillis = 0;
bool signupOK = false;
unsigned long count = 0;

void setup()
{

  Serial.begin(115200);
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  Serial.print("Connecting to Wi-Fi");
  unsigned long ms = millis();

  while (WiFi.status() != WL_CONNECTED)
  {
    Serial.print(".");
    delay(300);
  }
  Serial.println();
  Serial.print("Connected with IP: ");
  Serial.println(WiFi.localIP());
  Serial.println();

  Serial.printf("Firebase Client v%s\n\n", FIREBASE_CLIENT_VERSION);
  config.api_key = API_KEY;
  auth.user.email = USER_EMAIL;
  auth.user.password = USER_PASSWORD;
  config.database_url = DATABASE_URL;

  if (Firebase.signUp(&config, &auth, "", ""))
  {
    Serial.print("Sign Up OK");
    signupOK = true;
  }
  else
  {
    Serial.printf("%s\n", config.signer.signupError.message.c_str());
  }

  config.token_status_callback = tokenStatusCallback;
  fbdo.setResponseSize(2048);

  Firebase.begin(&config, &auth);
  Firebase.reconnectWiFi(true);
  config.timeout.serverResponse = 10 * 1000;
}

void GENERIC_data()
{

  if (Firebase.ready() && (millis() - sendDataPrevMillis > 60000 || sendDataPrevMillis == 0))
  {
    sendDataPrevMillis = millis();

//  BOOLEAN DATA

    //  GENERIC -- Set/Get boolean data:  GENERIC -> direction of rotation (forward/reverse)
    Serial.printf("Set bool... %s\n", Firebase.RTDB.setBool(&fbdo, F("/GENERIC/spinDirection/is_fwd/bool"), 1) ? "ok" : fbdo.errorReason().c_str());
    Serial.printf("Get bool... %s\n", Firebase.RTDB.getBool(&fbdo, FPSTR("/GENERIC/spinDirection/is_fwd/bool")) ? fbdo.to<bool>() ? "true" : "false" : fbdo.errorReason().c_str());
    Serial.printf("Set bool... %s\n", Firebase.RTDB.setBool(&fbdo, F("/GENERIC/spinDirection/is_rev/bool"), 1) ? "ok" : fbdo.errorReason().c_str());
    Serial.printf("Get bool... %s\n", Firebase.RTDB.getBool(&fbdo, FPSTR("/GENERIC/spinDirection/is_rev/bool")) ? fbdo.to<bool>() ? "true" : "false" : fbdo.errorReason().c_str());

    //  GENERIC -- Set/Get boolean data:  GENERIC -> magnet align (north/south top)
    Serial.printf("Set bool... %s\n", Firebase.RTDB.setBool(&fbdo, F("/GENERIC/magnetAlign/north_top/bool"), 1) ? "ok" : fbdo.errorReason().c_str());
    Serial.printf("Get bool... %s\n", Firebase.RTDB.getBool(&fbdo, FPSTR("/GENERIC/magnetAlign/north_top/bool")) ? fbdo.to<bool>() ? "true" : "false" : fbdo.errorReason().c_str());
    Serial.printf("Set bool... %s\n", Firebase.RTDB.setBool(&fbdo, F("/GENERIC/magnetAlign/south_top/bool"), 1) ? "ok" : fbdo.errorReason().c_str());
    Serial.printf("Get bool... %s\n", Firebase.RTDB.getBool(&fbdo, FPSTR("/GENERIC/magnetAlign/south_top/bool")) ? fbdo.to<bool>() ? "true" : "false" : fbdo.errorReason().c_str());

    bool bVal; //  BOOLEAN REF.

    //  GENERIC -- Get boolean ref:  GENERIC -> direction of rotation (forward/reverse)
    Serial.printf("Get bool ref... %s\n", Firebase.RTDB.getBool(&fbdo, F("/GENERIC/spinDirection/is_fwd/bool"), &bVal) ? bVal ? "true" : "false" : fbdo.errorReason().c_str());
    Serial.printf("Get bool ref... %s\n", Firebase.RTDB.getBool(&fbdo, F("/GENERIC/spinDirection/is_rev/bool"), &bVal) ? bVal ? "true" : "false" : fbdo.errorReason().c_str());

    //  GENERIC -- Get boolean ref:  GENERIC -> magnet align (north/south top)
    Serial.printf("Get bool ref... %s\n", Firebase.RTDB.getBool(&fbdo, F("/GENERIC/magnetAlign/north_top/bool"), &bVal) ? bVal ? "true" : "false" : fbdo.errorReason().c_str());
    Serial.printf("Get bool ref... %s\n", Firebase.RTDB.getBool(&fbdo, F("/GENERIC/magnetAlign/south_top/bool"), &bVal) ? bVal ? "true" : "false" : fbdo.errorReason().c_str());

      //  INTEGER DATA

    //  GENERIC -- Set/Get int data: GENERIC -> wire gauge
    Serial.printf("Set int... %s\n", Firebase.RTDB.setInt(&fbdo, F("/GENERIC/wireGauge/awg42/int"), 42) ? "ok" : fbdo.errorReason().c_str());
    Serial.printf("Get int... %s\n", Firebase.RTDB.getInt(&fbdo, F("/GENERIC/wireGauge/awg42/int")) ? String(fbdo.to<int>()).c_str() : fbdo.errorReason().c_str());
    Serial.printf("Set int... %s\n", Firebase.RTDB.setInt(&fbdo, F("/GENERIC/wireGauge/awg43/int"), 43) ? "ok" : fbdo.errorReason().c_str());
    Serial.printf("Get int... %s\n", Firebase.RTDB.getInt(&fbdo, F("/GENERIC/wireGauge/awg43/int")) ? String(fbdo.to<int>()).c_str() : fbdo.errorReason().c_str());

    //  GENERIC -- Set/Get int data: Generic -> unit number
    Serial.printf("Set int... %s\n", Firebase.RTDB.setInt(&fbdo, F("/GENERIC/unitNumber/unit1/int"), 1) ? "ok" : fbdo.errorReason().c_str());
    Serial.printf("Get int... %s\n", Firebase.RTDB.getInt(&fbdo, F("/GENERIC/unitNumber/unit1/int")) ? String(fbdo.to<int>()).c_str() : fbdo.errorReason().c_str());
    Serial.printf("Set int... %s\n", Firebase.RTDB.setInt(&fbdo, F("/GENERIC/unitNumber/unit2/int"), 2) ? "ok" : fbdo.errorReason().c_str());
    Serial.printf("Get int... %s\n", Firebase.RTDB.getInt(&fbdo, F("/GENERIC/unitNumber/unit2/int")) ? String(fbdo.to<int>()).c_str() : fbdo.errorReason().c_str());
    Serial.printf("Set int... %s\n", Firebase.RTDB.setInt(&fbdo, F("/GENERIC/unitNumber/unit3/int"), 3) ? "ok" : fbdo.errorReason().c_str());
    Serial.printf("Get int... %s\n", Firebase.RTDB.getInt(&fbdo, F("/GENERIC/unitNumber/unit3/int")) ? String(fbdo.to<int>()).c_str() : fbdo.errorReason().c_str());

   int iVal = 0; //  INTEGER REF.

    //  GENERIC -- Get int ref: GENERIC -> wire gauge
    Serial.printf("Get int ref... %s\n", Firebase.RTDB.getInt(&fbdo, F("/GENERIC/wireGauge/awg42/int"), &iVal) ? String(iVal).c_str() : fbdo.errorReason().c_str());
    Serial.printf("Get int ref... %s\n", Firebase.RTDB.getInt(&fbdo, F("/GENERIC/wireGauge/awg43/int"), &iVal) ? String(iVal).c_str() : fbdo.errorReason().c_str());

    //  FLOAT DATA

    //  GENERIC --  Set/Get float data: GENERIC -> wire diameter
    Serial.printf("Set float... %s\n", Firebase.RTDB.setFloat(&fbdo, F("/GENERIC/wireDiameter/awg42/float"), 0.0633) ? "ok" : fbdo.errorReason().c_str());
    Serial.printf("Get float... %s\n", Firebase.RTDB.getFloat(&fbdo, F("/GENERIC/wireDiameter/awg42/float")) ? String(fbdo.to<float>()).c_str() : fbdo.errorReason().c_str());
    Serial.printf("Set float... %s\n", Firebase.RTDB.setFloat(&fbdo, F("/GENERIC/wireDiameter/awg43/float"), 0.0559) ? "ok" : fbdo.errorReason().c_str());
    Serial.printf("Get float... %s\n", Firebase.RTDB.getFloat(&fbdo, F("/GENERIC/wireDiameter/awg43/float")) ? String(fbdo.to<float>()).c_str() : fbdo.errorReason().c_str());


    //  GENERIC -- Set/Get int data: Generic -> unit number
    Serial.printf("Get int ref... %s\n", Firebase.RTDB.getInt(&fbdo, F("/GENERIC/unitNumber/unit1/int"), &iVal) ? String(iVal).c_str() : fbdo.errorReason().c_str());
    Serial.printf("Get int ref... %s\n", Firebase.RTDB.getInt(&fbdo, F("/GENERIC/unitNumber/unit2/int"), &iVal) ? String(iVal).c_str() : fbdo.errorReason().c_str());
    Serial.printf("Get int ref... %s\n", Firebase.RTDB.getInt(&fbdo, F("/GENERIC/unitNumber/unit3/int"), &iVal) ? String(iVal).c_str() : fbdo.errorReason().c_str());

    FirebaseJson json;

    //  GENERIC
    if (count == 0)
    {
      json.set("value/round/" + String(count), F("generic data"));
      json.set(F("value/ts/.sv"), F("timestamp"));
      Serial.printf("Set json... %s\n", Firebase.RTDB.set(&fbdo, F("/GENERIC/json"), &json) ? "ok" : fbdo.errorReason().c_str());
    }
    else
    {
      json.add(String(count), F("updated"));
      Serial.printf("Update node... %s\n", Firebase.RTDB.updateNode(&fbdo, F("/GENERIC/json/value/round"), &json) ? "ok" : fbdo.errorReason().c_str());
    }
    
    Serial.println();
    count++;
  }
}

void loop()
{
  GENERIC_data();
}

Here is the output from the PlatformIO terminal upon building:

LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain+, Compatibility ~ soft
Found 34 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Firebase ESP32 Client @ 4.3.11
|-- WiFi @ 2.0.0
|-- SPIFFS @ 2.0.0
|-- FS @ 2.0.0
|-- SD_MMC @ 2.0.0
|-- SD @ 2.0.0
|-- SPI @ 2.0.0
|-- LittleFS @ 2.0.0
|-- Ethernet @ 2.0.0
|-- WiFiClientSecure @ 2.0.0
|-- Update @ 2.0.0
Building in release mode
Compiling .pio\build\esp32doit-devkit-v1\liba11\SD_MMC\SD_MMC.cpp.o
In file included from C:/.platformio/packages/framework-arduinoespressif32/libraries/SD_MMC/src/SD_MMC.cpp:16:
C:/.platformio/packages/framework-arduinoespressif32/libraries/SD_MMC/src/SD_MMC.h:21:10: fatal error: FS.h: No such file or directory

************************************************************
* Looking for FS.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:FS.h"
* Web  > https://registry.platformio.org/search?q=header:FS.h
*
************************************************************

 #include "FS.h"
          ^~~~~~
compilation terminated.
Archiving .pio\build\esp32doit-devkit-v1\lib326\libWiFi.a
Archiving .pio\build\esp32doit-devkit-v1\lib108\libEthernet.a
Compiling .pio\build\esp32doit-devkit-v1\lib0f3\WiFiClientSecure\ssl_client.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\lib356\Update\HttpsOTAUpdate.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\lib356\Update\Updater.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\lib413\Firebase ESP32 Client\Firebase.cpp.o
*** [.pio\build\esp32doit-devkit-v1\liba11\SD_MMC\SD_MMC.cpp.o] Error 1
Compiling .pio\build\esp32doit-devkit-v1\lib413\Firebase ESP32 Client\json\FirebaseJson.cpp.o

Incidentally, since adding ‘lib_ldf_mode = chain+’ to the Platformio.ini file, I’m now receiving the above library dependency error (not the same error reported by the OP).

It would seem that somehow my project folder became mangled. The sketch only needs these header files in order to build and upload:

#include <Arduino.h>
#include <WiFi.h>

#include <FirebaseESP32.h>
#include <addons/TokenHelper.h>
#include <addons/RTDBHelper.h>

For some reason the library dependencies that were throwing the errors were not required in any case.
I resolved my problem by creating a new project and pasting my sketch code into it. All is working as expected now.

1 Like