Libraries are a huge pain almost all the time

Adafruit BusIO includes Adafruit 12CDevice. It’s called for in one of the libraries I’m including.
It is in my bulk Libraries folder and in the project /lib folder.
I used the PIO utility to add Adafruit BusIO.

PIO is refusing to cooperate again.
There’s a lot of yellow, and it mentions a poor conversion somewhere, but that isn’t given as the reason this code won’t compile. It’s the stinkin’ library. I don’t have enough copies of it.

Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 1.12.4 > Espressif ESP32 Dev Module
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:
 - framework-arduinoespressif32 3.10004.200129 (1.0.4)
 - tool-esptoolpy 1.20600.0 (2.6.0)
 - toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 32 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Adafruit GFX Library> 1.10.0    
|   |-- <Adafruit BusIO> 0.0.2       
|   |   |-- <Wire> 1.0.1
|   |-- <SPI> 1.0
|   |-- <Wire> 1.0.1
|-- <Adafruit SSD1306> 2.3.1
|   |-- <Adafruit GFX Library> 1.10.0
|   |   |-- <Adafruit BusIO> 0.0.2   
|   |   |   |-- <Wire> 1.0.1
|   |   |-- <SPI> 1.0
|   |   |-- <Wire> 1.0.1
|   |-- <SPI> 1.0
|   |-- <Wire> 1.0.1
|-- <timelib>
|-- <Tone> 0.0.1
|-- <Wire> 1.0.1
Building in release mode
Compiling .pio\build\esp32dev\src\main.cpp.o
Generating partitions .pio\build\esp32dev\partitions.bin
Compiling .pio\build\esp32dev\libba3\Wire\Wire.cpp.o
Compiling .pio\build\esp32dev\lib704\Adafruit BusIO\Adafruit_I2CDevice.cpp.o
Compiling .pio\build\esp32dev\lib704\Adafruit BusIO\Adafruit_I2CRegister.cpp.o
Compiling .pio\build\esp32dev\lib5a1\SPI\SPI.cpp.o
lib\Adafruit BusIO\Adafruit_I2CDevice.cpp: In member function 'bool Adafruit_I2CDevice::read(uint8_t*, size_t, bool)':
lib\Adafruit BusIO\Adafruit_I2CDevice.cpp:99:51: warning: ISO C++ says that these are ambiguous, even though the worst conversion 
for the first is better than the worst conversion for the second:
   if (_wire->requestFrom(_addr, (uint8_t)len, stop) != len) {
                                                   ^
In file included from lib\Adafruit BusIO/Adafruit_I2CDevice.h:1:0,
                 from lib\Adafruit BusIO\Adafruit_I2CDevice.cpp:1:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\libraries\Wire\src/Wire.h:98:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int, int)
     uint8_t requestFrom(int address, int size, int sendStop);
             ^
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\libraries\Wire\src/Wire.h:96:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t, uint8_t)
     uint8_t requestFrom(uint8_t address, uint8_t size, uint8_t sendStop);
             ^
lib\Adafruit BusIO\Adafruit_I2CDevice.cpp:99:51: warning: ISO C++ says that these are ambiguous, even though the worst conversion 
for the first is better than the worst conversion for the second:
   if (_wire->requestFrom(_addr, (uint8_t)len, stop) != len) {
                                                   ^
In file included from lib\Adafruit BusIO/Adafruit_I2CDevice.h:1:0,
                 from lib\Adafruit BusIO\Adafruit_I2CDevice.cpp:1:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\libraries\Wire\src/Wire.h:98:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int, int)
     uint8_t requestFrom(int address, int size, int sendStop);
             ^
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\libraries\Wire\src/Wire.h:94:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint16_t, uint8_t, uint8_t)
     uint8_t requestFrom(uint16_t address, uint8_t size, uint8_t sendStop);
             ^
lib\Adafruit BusIO\Adafruit_I2CDevice.cpp:99:51: warning: ISO C++ says that these are ambiguous, even though the worst conversion 
for the first is better than the worst conversion for the second:
   if (_wire->requestFrom(_addr, (uint8_t)len, stop) != len) {
                                                   ^
In file included from lib\Adafruit BusIO/Adafruit_I2CDevice.h:1:0,
                 from lib\Adafruit BusIO\Adafruit_I2CDevice.cpp:1:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\libraries\Wire\src/Wire.h:98:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int, int)
     uint8_t requestFrom(int address, int size, int sendStop);
             ^
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\libraries\Wire\src/Wire.h:93:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint16_t, uint8_t, bool)
     uint8_t requestFrom(uint16_t address, uint8_t size, bool sendStop);
             ^
Archiving .pio\build\esp32dev\lib5a1\libSPI.a
Archiving .pio\build\esp32dev\lib704\libAdafruit BusIO.a
Compiling .pio\build\esp32dev\lib4d8\Adafruit GFX Library\Adafruit_GFX.cpp.o
Archiving .pio\build\esp32dev\libba3\libWire.a
Compiling .pio\build\esp32dev\lib4d8\Adafruit GFX Library\Adafruit_GrayOLED.cpp.o
Compiling .pio\build\esp32dev\lib4d8\Adafruit GFX Library\Adafruit_MonoOLED.cpp.o
Compiling .pio\build\esp32dev\lib4d8\Adafruit GFX Library\Adafruit_SPITFT.cpp.o
In file included from lib\Adafruit GFX Library\Adafruit_GrayOLED.cpp:20:0:
lib\Adafruit GFX Library\Adafruit_GrayOLED.h:31:32: fatal error: Adafruit_SPIDevice.h: No such file or directory

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

compilation terminated.
In file included from lib\Adafruit GFX Library\Adafruit_MonoOLED.cpp:20:0:
lib\Adafruit GFX Library\Adafruit_MonoOLED.h:31:32: fatal error: Adafruit_SPIDevice.h: No such file or directory

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

compilation terminated.
*** [.pio\build\esp32dev\lib4d8\Adafruit GFX Library\Adafruit_GrayOLED.cpp.o] Error 1
*** [.pio\build\esp32dev\lib4d8\Adafruit GFX Library\Adafruit_MonoOLED.cpp.o] Error 1
=================================================== [FAILED]
; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 9600
#include <Arduino.h>
#include <TimeLib.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Tone32.h>

#define PAUSE 3000 // How long to delay?
#define REST 1000

#define LED01 26
#define LED02 25
#define LED03 17
#define LED04 16
#define LED05 27

int LEDone = LED01;
int LEDtwo = LED02;
int LEDthree = LED03;
int LEDfour = LED04;
int LEDfive = LED05;


const int BZR01 = 14;
const int BZR02 = 12;
const int BZR03 = 13;
const int BZR04 = 5;
const int BZR05 = 13;




long randomNumber = 0L; // Use the "L" to tell compiler it's a long data type, not an int.

Adafruit_SSD1306 display(128, 64, &Wire, 8); //Declaring the display name (display)

// the setup routine runs once when you press reset:
void setup()
{
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32)
  // init done
  display.display();
  delay(100);
  display.clearDisplay();
  display.display();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  // initialize each of the digital pins as an output.
  pinMode(LEDone, OUTPUT);
  pinMode(LEDtwo, OUTPUT);
  pinMode(LEDthree, OUTPUT);
  pinMode(LEDfour, OUTPUT);
  pinMode(LEDone, OUTPUT);
  pinMode(LEDfive, OUTPUT);
  pinMode(BZR01, OUTPUT); 
  pinMode(BZR02, OUTPUT); 
  pinMode(BZR03, OUTPUT); 
  pinMode(BZR04, OUTPUT); 
  pinMode(BZR05, OUTPUT); 

  randomSeed(analogRead(0)); // This seeds the random number generator
}

long generateRandomNumber()
{
  return random(0, 1000000); // Generate random numbers between 0 and one million
}

void loop()
{
  display.setCursor(0, 0);
  display.clearDisplay();
  display.print(randomNumber);

  // Start with lights off.
  digitalWrite(LEDone, LOW); 
  digitalWrite(LEDtwo, LOW);
  digitalWrite(LEDthree, LOW);
  digitalWrite(LEDfour, LOW);
  digitalWrite(LEDfive, LOW);
  delay(PAUSE); 

  Serial.begin(9600);
  randomNumber = generateRandomNumber();
  Serial.println(randomNumber);

  if (randomNumber % 2 == 0) //Is it even? (Divisible without remainder by 2?)
  {
    digitalWrite(LEDone, HIGH); 
    digitalWrite(LEDtwo, HIGH); 
    digitalWrite(LEDthree, LOW);
    digitalWrite(LEDfour, LOW);
    digitalWrite(LEDfive, LOW);

    tone(BZR01, 1000);
  }
  else if (randomNumber % 2 == 1) //If there's a remainder, it's odd.
  {
    digitalWrite(LEDone, HIGH);
    digitalWrite(LEDtwo, LOW);
    digitalWrite(LEDthree, LOW);
    digitalWrite(LEDfour, LOW);
    digitalWrite(LEDfive, LOW);
    tone(BZR02, 1000, 1000);
  }
  delay(PAUSE);

  if (randomNumber % 3 == 0)
  {
    digitalWrite(LEDone, HIGH);
    digitalWrite(LEDtwo, HIGH); 
    digitalWrite(LEDthree, HIGH);
    digitalWrite(LEDfour, LOW);
    digitalWrite(LEDfive, LOW);
    tone(BZR03, 1000, 1000);
  }
  delay(PAUSE);

  if (randomNumber % 4 == 0)
  {
    digitalWrite(LEDone, HIGH); 
    digitalWrite(LEDtwo, HIGH); 
    digitalWrite(LEDthree, HIGH);
    digitalWrite(LEDfour, HIGH);
    digitalWrite(LEDfive, LOW);
    tone(BZR04, 1000, 1000);
  }
  delay(PAUSE);

  if (randomNumber % 5 == 0)
  {
    digitalWrite(LEDone, HIGH); 
    digitalWrite(LEDtwo, HIGH); 
    digitalWrite(LEDthree, HIGH);
    digitalWrite(LEDfour, HIGH);
    digitalWrite(LEDfive, HIGH);
    tone(BZR05, 1000, 1000);
  }
  delay(PAUSE);

  if (randomNumber == 0 || randomNumber == 1)// Is it a prime number?

  {
    digitalWrite(LEDone, HIGH);
    digitalWrite(LEDtwo, HIGH);
    digitalWrite(LEDthree, HIGH);
    digitalWrite(LEDfour, HIGH);
    digitalWrite(LEDfive, HIGH);
    tone(BZR01, 300, 1000);
    tone(BZR02, 500, 1000);
    tone(BZR03, 700, 1000);
    tone(BZR04, 900, 1000);
    tone(BZR05, 1100, 1000);
    delay(500);
    digitalWrite(LEDone, LOW);
    digitalWrite(LEDtwo, LOW);
    digitalWrite(LEDthree, LOW);
    digitalWrite(LEDfour, LOW);
    digitalWrite(LEDfive, LOW);
    digitalWrite(BZR01, LOW);
    digitalWrite(BZR02, LOW);
    digitalWrite(BZR03, LOW);
    digitalWrite(BZR04, LOW);
    digitalWrite(BZR05, LOW);
    delay(500);
    digitalWrite(LEDone, HIGH);
    digitalWrite(LEDtwo, HIGH);
    digitalWrite(LEDthree, HIGH);
    digitalWrite(LEDfour, HIGH);
    digitalWrite(LEDfive, HIGH);
    tone(BZR01, 300, 1000);
    tone(BZR02, 500, 1000);
    tone(BZR03, 700, 1000);
    tone(BZR04, 900, 1000);
    tone(BZR05, 1100, 1000);
    delay(500);
    digitalWrite(LEDone, LOW);
    digitalWrite(LEDtwo, LOW);
    digitalWrite(LEDthree, LOW);
    digitalWrite(LEDfour, LOW);
    digitalWrite(LEDfive, LOW);
    digitalWrite(BZR01, LOW);
    digitalWrite(BZR02, LOW);
    digitalWrite(BZR03, LOW);
    digitalWrite(BZR04, LOW);
    digitalWrite(BZR05, LOW);
    }

  delay(PAUSE); // Pause for 3 seconds
}

By the way, adding the Tone32 library cleared ‘tone’ on my R32.
This will run on a WeMos D1 R32.

I’ve restarted the application about seven times and restarted the PC three times. I deleted the PIO folder three or four times.

Try adding to main.cpp:
#include <Adafruit_SPIDevice.h>

Something has changed as I’m having to include Adafruit_I2CDevice.h in several projects that would build before without it…

1 Like

That was happening to me, the Adafruit_I2CDevice, but my frustration came from having it in the actual folder while it was asking me to add it.

I spend about half my time trying and failing to add libraries. That hassle blends in with the rest, I can’t resolve them. Even libraries I add with the PIO thing fail to get seen.

Since I’m doing what I’ve been told to do and it doesn’t work, I don’t think it works very well.
.

I just really started here a few months ago, from Arduino.

The following worked just fine for me…

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 9600
lib_deps =
   paulstoffregen/Time
   adafruit/Adafruit SSD1306
   lbernstone/Tone32

In other words, I told PlatformIO to manage the libraries itself, and it did just fine. If you encounter the fatal error: Adafruit_SPIDevice.h: No such file or directory error… try adding lib_ldf_mode = chain+ or lib_ldf_mode = deep+ to the platformio.ini and see if that resolves it. It sometimes fails due to how Adafruit coded that particular include, and PlatformIO needs to work harder to figure out what they are doing.

You are probably also having issues due to the version of BusIO you are using… 0.0.2??? Really? This is what your dependency graph should have looked like…

Scanning dependencies...
Dependency Graph
|-- <Time> 1.6.0
|-- <Adafruit SSD1306> 2.4.0
|   |-- <Adafruit GFX Library> 1.10.0
|   |   |-- <Adafruit BusIO> 1.4.1
|   |   |   |-- <SPI> 1.0
|   |   |   |-- <Wire> 1.0.1
|   |   |-- <Wire> 1.0.1
|   |   |-- <SPI> 1.0
|   |-- <SPI> 1.0
|   |-- <Wire> 1.0.1
|-- <Tone32> 1.0.0
|-- <Adafruit GFX Library> 1.10.0
|   |-- <Adafruit BusIO> 1.4.1
|   |   |-- <SPI> 1.0
|   |   |-- <Wire> 1.0.1
|   |-- <Wire> 1.0.1
|   |-- <SPI> 1.0
|-- <Adafruit BusIO> 1.4.1
|   |-- <SPI> 1.0
|   |-- <Wire> 1.0.1
|-- <Wire> 1.0.1
Building in release mode
1 Like

Perhaps this will help make library handling a little less painful. I hope so anyway. It’s based on my experience - I might have some stuff incorrect or incomplete below, hopefully I’ll be corrected if so.

PlatformIO Library Handling.

I’m assuming PlatformIO version 5.0.0 and above, as some of this stuff is new. I’m also only “skilled” (for want of a better word) in AVR stuff at the moment, so the following is biased towards AVR kit - Uno, Duemilanove, NormDuino!

None of the following will be global, everything relates to local installations for the current project.

How are Libraries Installed?

When you use lib_deps, the library details are passed to the pio lib install command to install the appropriate library locally.

Library Names

Adding the following to lib_deps does different things:

  • lib_deps=servo will install a library which is built in to the framework you are using. I’m on AVR so I get the Arduino Servo library installed for my project. The install is local to this project only.

  • lib_deps=NormanDunbar/Servo will find and install the Servo library supplied by some bloke named NormanDunbar. In the event that there is a Servo library in the framework I’m using, it will not be used, only the NormanDunbar supplied one is used.

  • lib_deps=https://github.com/NormanDunbar/Servo.git will look for a Servo library, on GitHub.com, under a repository named “Servo” and in the user “NormanDunbar”. Don’t go looking though, there isn’t one!

  • lib_deps=NDServo=https://github.com/NormanDunbar/Servo.git I’m not sure about this one. I think it gives the afore mentioned GitHub Servo library, an alias? I’ve never used this option. Anyone want to jump in?

Library Version Numbers

The above will just install a library, whichever happens to be the latest version. Usually, that’s fine. However, sometimes a new version of a library will cause problems, for example, and should be ignored.

  • lib_deps=servo@1.2.3 will only ever install and use Servo library 1.2.3.

  • lib_deps=servo@^1.2.3 is the recommended method to use. It will use the library version given, or any backwards compatible future versions.

  • lib_deps=servo@~1.2.3 will only ever install or use the Servo library, versions 1.2.x where ‘x’ is 3 or higher.

  • lib_deps=servo@>1.2.3 will use any version of the library greater than version 1.2.3. The highest version found will be used.

  • lib_deps=servo@>=1.2.3 will use any version of the library greater than or equal to version 1.2.3. The highest version found will be used.

  • lib_deps=servo@<1.2.3 will use any version of the library less than version 1.2.3. The highest version found which is lower than 1.2.3, will be used.

  • lib_deps=servo@<=1.2.3 will use any version of the library less than or equal to version 1.2.3. The highest version found which is lower than 1.2.3, will be used assuming that 1.2.3 is not found.

So, you have version 1.2.3 of the servo library, but version 1.2.4 is available but has a bug that stops it working for you. What to do? Simple, tell PlatformIO not to use 1.2.4.

  • lib_deps=servo@>=1.2.3,!1.2.4 will use any version of the library greater than or equal to version 1.2.3, but not version 1.2.4. The highest allowed version found will be used.

Ah! But! There’s a version 2.0.0 out now, and it is not suitable for my board. 1.2.4 is still broken though. What can I do?

  • lib_deps=servo@>=1.2.3,!1.2.4,<2.0.0 will use any version of the library greater than or equal to version 1.2.3, but not version 1.2.4. The highest allowed version found which is less than version 2.0.0 will be used.

My Local Libraries

Ok, this is all well and good, but I have written my own libraries and I’ve got them saved away safely in a central location. How can I use them in my projects? Especially as I just want all my projects to use them, I don’t want to install each one each and every time I start a new project?

Let’s assume that I have this sort of thing set up. I don’t, but let’s assume under my central library directory named /home/norman/SourceCode/Libraries/:

  • AVRusart
  • cBuffer
  • Etc.

In each of those directories, I have the header and source files for my various libraries. I can therefore add the following line(s) to my ini file. There are three ‘/’ characters after the file word, because I’m on Linux. I suspect, Windows would use file://c:\whatever\wherever\something etc. (Don’t quote me!)

  • lib_deps=file:///home/norman/SourceCode/Libraries/AVRusart to include my USART stuff.

If I need both libraries, I can do this:

  •   lib_deps=file:///home/norman/SourceCode/Libraries/cBuffer
      lib_deps=file:///home/norman/SourceCode/Libraries/AVRusart
    

I can even zip up the source and header files in each of those libraries to save space, and get PlatformIO to unzip them for me:

  • lib_deps=file:///home/norman/SourceCode/Libraries/AVRusart/AVRusart.zip.

And, as I’m on Linux, I’m most likely to have a tarred up and compressed source file.

  • lib_deps=file:///home/norman/SourceCode/Libraries/AVRusart/AVRusart.tar.gz.

Where is my Library?

Assuming lib_deps=servo, then the pio lib install command will find the best version of the Servo library, and copy the source to <PROJECT_HOME>/.pio/libdeps/<ENVIRONMENT>/<LIBRARY_NAME>/

For my Uno, and the Servo library, that would be: /home/norman/SourceCode/PlatformIO/PIO_Servo/.pio/libdeps/uno/Servo/.

Under that directory, I would (can!) see the following files and directories:

  • keywords.txt the file which tells the Arduino IDE how to colourise keywords for this library.
  • library.properties another Arduino IDE file for the library manager.
  • README.adoc contains brief details about the library, and how it is licenced.
  • examples/ where the example sketches can be found – examples/Knob and examples/Sweep.
  • src/ where the source file(s) for the Servo library can be found for various frameworks. The header file Servo.h lives in src/. I have the following sub-directories where appropriate versions of the Servo library files live:
    • src/avr/
    • src/mbed/
    • src/megaavr/
    • src/ntf52/
    • src/sam/
    • src/samd/
    • src/stm32f4/

Compiling a library.

When you compile a project, any library sources will also be compiled into <PROJECT_HOME>/.pio/build/<ENVIRONMENT>/libnnnn<LIBRARY_NAME>/<FRAMEWORK_NAME> which in my example is: /home/norman/SourceCode/PlatformIO/PIO_Servo/.pio/build/uno//lib506/Servo/

Note: I have no idea where the lib506 comes from!

Summary

I never, manually download a library and install it somewhere. I let PlatformIO do all the hard work of finding and installing the libraries for me.

I don’t use global libraries, each project gets its own install, if necessary, locally.

Lib_deps does all the hard work for me, I don’t even have to think about it.

Have fun!

First of all, thank you very much for this.

This is automatic, no? I don’t see this happening?
I’m not typing anything in. I saw the place where you select commands from a drop-down, where Intellisense rebuild lives. But I’m just using the GUI.

I’ll want to use commands eventually. ESP32 has a catalog of AT commands, and I’ll use esp-idf at least once. I think I’ll need to use it when I use the ESP Upload Tool to upload more than one program.

I don’t want to link. I want the files to be located under PIO’s umbrella.
I’m going to use the first good program as an excuse to write to a Tiny85, and I’ll want to optimize everything in that folder as a movable unit. I’d rather not introduce links to third-party/third application objects only to remove them later. I want the compiler to travel a short ‘distance.’

I’ll try lib_deps first. If what you say about lib_deps is true, I’ll be very happy. I really want to be wrestling with my C++ literacy.
And I just use the name of the library with no quotes, nothing?

But for stuff I want to build for real, I’l put them right into the SRC folder like you do. Since that’s the first folder the compiler reads, that’s where I want all the files. It will scan empty folders after that.
If it’s looking for the /include folder, I won’t delete the empty folder.

And versions- I was worried about that. I’ve only used a few sites as sources for libraries (GitHub, https://www.arduinolibraries.info/), and it SEEMS like these two should offer the latest versions first. I know PIO just updated, and it’s good about library and platform updates. My stored libraries will be the weak link. I’m sure lots of them are outdated.

So PIO sees

lib_ deps= Tone32

and it goes online to find the latest verion?

How can I then go download that latest version chosen by PIO?
Is it identified in the log text during compile in a way I can read?

1 Like

Error:
Building in release mode
Compiling .pio\build\esp32dev\src\main.cpp.o
Generating partitions .pio\build\esp32dev\partitions.bin
Compiling .pio\build\esp32dev\libba3\Wire\Wire.cpp.o
Compiling .pio\build\esp32dev\libd16\Tone32\Tone32.cpp.o
Archiving .pio\build\esp32dev\libFrameworkArduinoVariant.a
src\main.cpp:3:21: fatal error: TimeLib.h: No such file or directo

.ini:

[env:esp32dev]

platform = espressif32

board = esp32dev

framework = arduino

monitor_speed = 9600

lib_deps =  TimeLib

            Wire

            Adafruit_GFX

            Adafruit_SSD1306

            Tone32

Generating partitions .pio\build\esp32dev\partitions.bin
Archiving .pio\build\esp32dev\lib021\libTimeLib.a
Compiling .pio\build\esp32dev\libba3\Wire\Wire.cpp.o
Compiling .pio\build\esp32dev\libd16\Tone32\Tone32.cpp.o
Archiving .pio\build\esp32dev\libFrameworkArduinoVariant.a
src\main.cpp:5:26: fatal error: Adafruit_GFX.h: No such file or directory

lib_deps doesn’t work.

It got almost finished after I pasted the folders into /lib:

In file included from C:\Users\joema.platformio\lib\Adafruit BusIO/Adafruit_I2CDevice.h:1:0,
from C:\Users\joema.platformio\lib\Adafruit BusIO\Adafruit_I2CDevice.cpp:1:
C:\Users\joema.platformio\packages\framework-arduinoespressif32\libraries\Wire\src/Wire.h:98:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int, int)
uint8_t requestFrom(int address, int size, int sendStop);
^
C:\Users\joema.platformio\packages\framework-arduinoespressif32\libraries\Wire\src/Wire.h:93:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint16_t, uint8_t, bool)
uint8_t requestFrom(uint16_t address, uint8_t size, bool sendStop);
^
Archiving .pio\build\esp32dev\lib99d\libAdafruit BusIO.a
Compiling .pio\build\esp32dev\libd72\Adafruit GFX Library\Adafruit_MonoOLED.cpp.o
In file included from lib\Adafruit GFX Library\Adafruit_GrayOLED.cpp:20:0:
lib\Adafruit GFX Library\Adafruit_GrayOLED.h:31:32: fatal error: Adafruit_SPIDevice.h: No such file or directory

The goal posts are moving.

And now that I have BusIO pasted in:

Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 1.12.4 > Espressif ESP32 Dev Module
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:
 - framework-arduinoespressif32 3.10004.200129 (1.0.4)
 - tool-esptoolpy 1.20600.0 (2.6.0)
 - toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Looking for Adafruit_SSD1306 library in registry
Warning! Library `{'name': 'Adafruit_SSD1306', 'requirements': None}` has not been found in PlatformIO Registry.
You can ignore this message, if `{'name': 'Adafruit_SSD1306', 'requirements': None}` is a built-in library (included in framework, SDK). E.g., SPI, Wire, etc.
Found 33 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <TimeLib>
|-- <Wire> 1.0.1
|-- <Tone32> 1.0.0
|-- <Adafruit GFX Library> 1.10.0
|   |-- <Adafruit BusIO> 1.4.1
|   |   |-- <Wire> 1.0.1
|   |   |-- <SPI> 1.0
|   |-- <SPI> 1.0
|   |-- <Wire> 1.0.1
|-- <Adafruit SSD1306> 2.3.1
|   |-- <Adafruit GFX Library> 1.10.0
|   |   |-- <Adafruit BusIO> 1.4.1
|   |   |   |-- <Wire> 1.0.1
|   |   |   |-- <SPI> 1.0
|   |   |-- <SPI> 1.0
|   |   |-- <Wire> 1.0.1
|   |-- <SPI> 1.0
|   |-- <Wire> 1.0.1
Building in release mode
Compiling .pio\build\esp32dev\src\main.cpp.o
Generating partitions .pio\build\esp32dev\partitions.bin
Archiving .pio\build\esp32dev\lib021\libTimeLib.a
Compiling .pio\build\esp32dev\libba3\Wire\Wire.cpp.o
Compiling .pio\build\esp32dev\libd16\Tone32\Tone32.cpp.o
Compiling .pio\build\esp32dev\lib5a1\SPI\SPI.cpp.o
Archiving .pio\build\esp32dev\lib5a1\libSPI.a
Compiling .pio\build\esp32dev\lib4de\Adafruit BusIO\Adafruit_BusIO_Register.cpp.o
Compiling .pio\build\esp32dev\lib4de\Adafruit BusIO\Adafruit_I2CDevice.cpp.o
Archiving .pio\build\esp32dev\libd16\libTone32.a
Compiling .pio\build\esp32dev\lib4de\Adafruit BusIO\Adafruit_I2CRegister.cpp.o
Archiving .pio\build\esp32dev\libba3\libWire.a
Compiling .pio\build\esp32dev\lib4de\Adafruit BusIO\Adafruit_SPIDevice.cpp.o
lib\Adafruit BusIO\Adafruit_I2CRegister.cpp:3:145: error: ISO C++ forbids declaration of 'Adafruit_I2CRegister' with no type [-fpermissive]
 Adafruit_I2CRegister::Adafruit_I2CRegister(Adafruit_I2CDevice *device, uint16_t reg_addr, uint8_t width, uint8_t bitorder, uint8_t address_width) {
                                                                                                                                                 ^
lib\Adafruit BusIO\Adafruit_I2CRegister.cpp:3:145: error: no 'int Adafruit_BusIO_Register::Adafruit_I2CRegister(Adafruit_I2CDevice*, uint16_t, uint8_t, uint8_t, uint8_t)' member function declared in class 'Adafruit_BusIO_Register'
lib\Adafruit BusIO\Adafruit_I2CRegister.cpp: In member function 'bool Adafruit_BusIO_Register::write(uint8_t*, uint8_t)':
lib\Adafruit BusIO\Adafruit_I2CRegister.cpp:14:9: error: '_device' was not declared in this scope
   if (! _device->write(buffer, len, true, addrbuffer, _addrwidth)) {
         ^
lib\Adafruit BusIO\Adafruit_I2CRegister.cpp: In member function 'bool Adafruit_BusIO_Register::write(uint32_t, uint8_t)':
lib\Adafruit BusIO\Adafruit_I2CRegister.cpp:29:9: error: '_bitorder' was not declared in this scope
     if (_bitorder == LSBFIRST) {
         ^
lib\Adafruit BusIO\Adafruit_I2CRegister.cpp: In member function 'uint32_t Adafruit_BusIO_Register::read()':
lib\Adafruit BusIO\Adafruit_I2CRegister.cpp:49:10: error: '_bitorder' was not declared in this scope
      if (_bitorder == LSBFIRST) {
          ^
lib\Adafruit BusIO\Adafruit_I2CRegister.cpp: In member function 'bool Adafruit_BusIO_Register::read(uint8_t*, uint8_t)':
Compiling .pio\build\esp32dev\libd72\Adafruit GFX Library\Adafruit_GFX.cpp.o
lib\Adafruit BusIO\Adafruit_I2CRegister.cpp:62:9: error: '_device' was not declared in this scope
   if (! _device->write_then_read(_buffer, 1, buffer, len)) {
         ^
lib\Adafruit BusIO\Adafruit_I2CRegister.cpp: In member function 'bool Adafruit_BusIO_Register::read(uint16_t*)':
lib\Adafruit BusIO\Adafruit_I2CRegister.cpp:73:7: error: '_bitorder' was not declared in this scope
   if (_bitorder == LSBFIRST) {
       ^
lib\Adafruit BusIO\Adafruit_I2CRegister.cpp: At global scope:
lib\Adafruit BusIO\Adafruit_I2CRegister.cpp:105:106: error: ISO C++ forbids declaration of 'Adafruit_I2CRegisterBits' with no type [-fpermissive]
 Adafruit_I2CRegisterBits::Adafruit_I2CRegisterBits(Adafruit_I2CRegister *reg, uint8_t bits, uint8_t shift) {
                                                                                                          ^
lib\Adafruit BusIO\Adafruit_I2CRegister.cpp:105:106: error: no 'int Adafruit_BusIO_RegisterBits::Adafruit_I2CRegisterBits(Adafruit_I2CRegister*, uint8_t, uint8_t)' member function declared in class 'Adafruit_BusIO_RegisterBits'  
lib\Adafruit BusIO\Adafruit_I2CRegister.cpp:117:6: error: prototype for 'void Adafruit_BusIO_RegisterBits::write(uint32_t)' does not match any in class 'Adafruit_BusIO_RegisterBits'
 void Adafruit_I2CRegisterBits::write(uint32_t data) {
      ^
In file included from lib\Adafruit BusIO/Adafruit_I2CRegister.h:1:0,
                 from lib\Adafruit BusIO\Adafruit_I2CRegister.cpp:1:
lib\Adafruit BusIO/Adafruit_BusIO_Register.h:66:8: error: candidate is: bool Adafruit_BusIO_RegisterBits::write(uint32_t)
   bool write(uint32_t value);
        ^
*** [.pio\build\esp32dev\lib4de\Adafruit BusIO\Adafruit_I2CRegister.cpp.o] Error 1
==================================================================================================== [FAILED] Too

I downloaded fresh zip files for all the libraries in this program and saved them to the /lib folder, and it compiled all the way.