Way too sick of unreliable library stuff

I’m too upset to write anything.

Please make your lib_deps work all the time.

It doesn’t. In fact, it works eventually, and then fails next time you want to use the file.

I got my random number thing to work, but I’m still spending way over half my time not having libraries I know i HAVE, and now that I;m using lib_deps I’m not even supposed to have them. But I pasted them into the /lib folder BECAUSE NOTHING WORKS AS IF IT WERE PLANNED TO ALWAYS WORK. And no, pasting it in didn’t work.

i can’t get this crapplication to work right.
I can’t be the only one enduring this.

It fails and gets worse.

Every stinkin’ script fails because this lib_deps thing does not work.

It fails over half the time, so you can’t say it works.
And I can’t do anything because of it.

Morning Joe,

I have your project here, many thanks. Seeing your code etc has shown the problem.

TL;DR

I managed to get it to compile on an Uno, in only two compilation attempts.

In summary of your problems, and as pointed out many times previously:

  • You have a pile of crud in lib.
  • You are #including the wrong headers, they are local not system headers, use double quotes not angle brackets;
  • You have a pile of crud in lib_deps - agreed, you just copied the ES project over and renamed it to uno.
  • There appears to be a problem with the fonts library, I cannot use it or download it (via lib_deps) so I had to remove it.
  • Adafruit GFX doesn’t seem to be available for linux_x86_64, but then it installs anyway. Interesting!
  • I cleaned out the potential crud in .pio.

It now compiles every time, it’s as happy as a piglet in brown stuff. :rofl:

However, this project will not work on an Uno for one main reason, the Uno only has a single channel for tone() - it cannot do more than one note at a time.

I think you have been corrupted by the Arduino IDE in that:

  • You appear to confuse a header file with an actual library, they are not (always) the same thing.
  • You may be confused when `#include’ is used as to when to use system headers and when to use local ones.
  • Also, stop putting stuff in lib - unless you write it yourself, say a class header and implementation file.

In addition, You have far too many threads open and appear to be missing responses to your questions on other threads, then you start another. Please, slow down, take your time, and read the replies. Thanks.

HTH

Right, gory details follow of what I had to do to compile the Uno version. as I said, it won’t run, but it will compile, each and every time.

In platformio.ini:

  • Remove Arduino from lib_deps;
  • Remove Wire from lib_deps;
  • Remove Tone32 from lib_deps;
  • Change all Adafruit_xxx to Adafruit xxx.

In lib Directory:

  • Deleted everything, from lib.

In .pio Directory:

  • Deleted build;
  • Deleted libdeps.

First Compile

The following is the extracted good news, and some bad!

Library Manager: Time @ 1.6.0 has been installed!

Library Manager: Installing Adafruit GFX
Warning! Could not find the package with 'Adafruit GFX' requirements for your system 'linux_x86_64'

Library Manager: Installing Adafruit SSD1306
Library Manager: Adafruit SSD1306 @ 2.4.0 has been installed!

Library Manager: Installing dependencies...
Library Manager: Installing Adafruit GFX Library
Library Manager: Adafruit GFX Library @ 1.10.1 has been installed!

Library Manager: Installing dependencies...
Library Manager: Installing Adafruit BusIO
Library Manager: Adafruit BusIO @ 1.4.2 has been installed!
Library Manager: Installing Fonts/FreeSerif9pt7b
KeyError: 'versions':
  File "/home/norman/.platformio/penv/lib/python3.6/site-packages/platformio/builder/main.py", line 169:
    env.SConscript("$BUILD_SCRIPT")
  Etc etc etc

So, by removing all the crud (technical Term) you had dumped into lib, the libraries were correctly installed.

OK, I’ll give you a problem in the fonts library, not sure why that’s needed though.

Back in platformio.ini:

  • Removed Fonts/FreeSerif9pt7b from lib_deps.

In src/main.cpp:

  • Removed #include <Tone32.h> line.
  • Removed #include <Fonts/FreeSerif9pt7b.h> line.

These are not system headers, they are local headers, DO NOT wrap them in ‘<’ and ‘>’ they should be in double quotes. The code now looks like:

#include "Arduino.h"
#include "Time.h"
#include "Wire.h"
#include "Adafruit_GFX.h"
#include "Adafruit_SSD1306.h"
  • Commented out the line display.setFont(&FreeSerif9pt7b); as we are not able to use the fonts.

Second Compile:

It worked!

Processing uno (platform: atmelavr; board: uno; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR (2.2.0) > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (simavr) On-board (simavr)
PACKAGES: 
 - framework-arduino-avr 5.0.0 
 - toolchain-atmelavr 1.50400.190710 (5.4.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Library Manager: Installing Adafruit GFX
Warning! Could not find the package with 'Adafruit GFX' requirements for your system 'linux_x86_64'
Found 9 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Time> 1.6.0
|-- <Adafruit SSD1306> 2.4.0
|   |-- <Adafruit GFX Library> 1.10.1
|   |   |-- <Adafruit BusIO> 1.4.2
|   |   |   |-- <Wire> 1.0
|   |   |   |-- <SPI> 1.0
|   |   |-- <Wire> 1.0
|   |   |-- <SPI> 1.0
|   |-- <SPI> 1.0
|   |-- <Wire> 1.0
|-- <Adafruit BusIO> 1.4.2
|   |-- <Wire> 1.0
|   |-- <SPI> 1.0
|-- <Adafruit GFX Library> 1.10.1
|   |-- <Adafruit BusIO> 1.4.2
|   |   |-- <Wire> 1.0
|   |   |-- <SPI> 1.0
|   |-- <Wire> 1.0
|   |-- <SPI> 1.0
|-- <Wire> 1.0
Building in release mode
Compiling .pio/build/uno/src/main.cpp.o
Compiling .pio/build/uno/lib7b7/Wire/utility/twi.c.o
Compiling .pio/build/uno/lib178/SPI/SPI.cpp.o
Archiving .pio/build/uno/lib7b7/libWire.a
Indexing .pio/build/uno/lib7b7/libWire.a
Compiling .pio/build/uno/lib933/Adafruit BusIO/Adafruit_BusIO_Register.cpp.o
Archiving .pio/build/uno/lib178/libSPI.a
Indexing .pio/build/uno/lib178/libSPI.a
Compiling .pio/build/uno/lib933/Adafruit BusIO/Adafruit_I2CDevice.cpp.o
Compiling .pio/build/uno/lib933/Adafruit BusIO/Adafruit_SPIDevice.cpp.o
Compiling .pio/build/uno/lib42d/Adafruit GFX Library/Adafruit_GFX.cpp.o
Archiving .pio/build/uno/lib933/libAdafruit BusIO.a
Indexing .pio/build/uno/lib933/libAdafruit BusIO.a
Compiling .pio/build/uno/lib42d/Adafruit GFX Library/Adafruit_GrayOLED.cpp.o
.pio/libdeps/uno/Adafruit GFX Library/Adafruit_GFX.cpp: In member function 'void GFXcanvas1::drawFastRawHLine(int16_t, int16_t, int16_t, uint16_t)':
.pio/libdeps/uno/Adafruit GFX Library/Adafruit_GFX.cpp:2070:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int8_t i = 0; i < lastByteBits; i++) {
                            ^
.pio/libdeps/uno/Adafruit GFX Library/Adafruit_GFX.cpp: In member function 'void GFXcanvas16::drawFastRawHLine(int16_t, int16_t, int16_t, uint16_t)':
.pio/libdeps/uno/Adafruit GFX Library/Adafruit_GFX.cpp:2620:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int16_t i = buffer_index; i < buffer_index + w; i++) {
                                    ^
Compiling .pio/build/uno/lib42d/Adafruit GFX Library/Adafruit_SPITFT.cpp.o
Compiling .pio/build/uno/lib42d/Adafruit GFX Library/glcdfont.c.o
Compiling .pio/build/uno/lib264/Adafruit SSD1306/Adafruit_SSD1306.cpp.o
Archiving .pio/build/uno/lib42d/libAdafruit GFX Library.a
Indexing .pio/build/uno/lib42d/libAdafruit GFX Library.a
Archiving .pio/build/uno/libFrameworkArduinoVariant.a
Indexing .pio/build/uno/libFrameworkArduinoVariant.a
Compiling .pio/build/uno/FrameworkArduino/CDC.cpp.o
Compiling .pio/build/uno/FrameworkArduino/HardwareSerial.cpp.o
Archiving .pio/build/uno/lib264/libAdafruit SSD1306.a
Indexing .pio/build/uno/lib264/libAdafruit SSD1306.a
Compiling .pio/build/uno/FrameworkArduino/HardwareSerial0.cpp.o
Compiling .pio/build/uno/FrameworkArduino/HardwareSerial1.cpp.o
Compiling .pio/build/uno/FrameworkArduino/HardwareSerial2.cpp.o
Compiling .pio/build/uno/FrameworkArduino/HardwareSerial3.cpp.o
Compiling .pio/build/uno/FrameworkArduino/IPAddress.cpp.o
Compiling .pio/build/uno/FrameworkArduino/PluggableUSB.cpp.o
Compiling .pio/build/uno/FrameworkArduino/Print.cpp.o
Compiling .pio/build/uno/FrameworkArduino/Stream.cpp.o
Compiling .pio/build/uno/FrameworkArduino/Tone.cpp.o
Compiling .pio/build/uno/FrameworkArduino/USBCore.cpp.o
Compiling .pio/build/uno/FrameworkArduino/WInterrupts.c.o
Compiling .pio/build/uno/FrameworkArduino/WMath.cpp.o
Compiling .pio/build/uno/FrameworkArduino/WString.cpp.o
Compiling .pio/build/uno/FrameworkArduino/abi.cpp.o
Compiling .pio/build/uno/FrameworkArduino/hooks.c.o
Compiling .pio/build/uno/FrameworkArduino/main.cpp.o
Compiling .pio/build/uno/FrameworkArduino/new.cpp.o
Compiling .pio/build/uno/FrameworkArduino/wiring.c.o
Compiling .pio/build/uno/FrameworkArduino/wiring_analog.c.o
Compiling .pio/build/uno/FrameworkArduino/wiring_digital.c.o
Compiling .pio/build/uno/FrameworkArduino/wiring_pulse.S.o
Compiling .pio/build/uno/FrameworkArduino/wiring_pulse.c.o
Compiling .pio/build/uno/FrameworkArduino/wiring_shift.c.o
Archiving .pio/build/uno/libFrameworkArduino.a
Indexing .pio/build/uno/libFrameworkArduino.a
Linking .pio/build/uno/firmware.elf
Building .pio/build/uno/firmware.hex
Checking size .pio/build/uno/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [===       ]  28.7% (used 588 bytes from 2048 bytes)
Flash: [=====     ]  53.0% (used 17104 bytes from 32256 bytes)
==================================================== [SUCCESS] Took 4.30 seconds ====================================================

Cheers,
Norm.

Thank you Norm!
I am hyper-aware of the multitude of threads. I’m trying to kick up as much dust as possible. Posted the Grand Unified Question this morning.

Oh- this is the program that successfully uploaded a whole bunch of times after I used lib_deps with no underscores.

And I had several buzzers buzzing at once.

htttp://www.monsterlaboratories.xyz/IMG_8750.MOV

You are very welcome.

Yes,but it makes it hard to keep up and follow. If someone else in the future is struggling, following one thread is better than jumping between lots. Best avoided really.

Disclaimer I’m not a forum moderator (here, anyway), nor do I play one on TV. :wink:

Cheers,
Norm.

Each of these threads holds one or two gems that could only have been elicited in this exact way.

Fonts is actually in GFX, it’s fonts for the OLED.

I’m quite happy to petition Ivan that you be one, if you promise to take Joe to one side and deal with 'im :stuck_out_tongue:

It works every time. If you put crap in, expect crap out. Only a poor tradesman blames his tools for not working when he doesn’t operate them properly.

Once again, you are listing built in libraries which you should not be ‘Arduino, Wire’, specifying the wrong library names ‘Adafruit GFX’ != ‘Adafruit GFX Library’, ‘Adafruit BME680’ != ‘Adafruit BME680 Library’. You should not be specifying ‘Fonts/FreeSerif9pb7b’ as that is a font included with the Adafruit GFX Library.

As a moderator, I have no issue with someone finding problems with PlatformIO, or having trouble with code due to the hand-holding/poor coding practices that the Arduino IDE encouraged. I am getting fed up with the multiple threads repeating the same thing over and over, instead of sticking to the one thread per issue. The moderate posts option is looking rather attractive for Joe… that should slow him down and make him think about what he is saying, and wait for a reply before posting yet another thread. Consider this a friendly warning… :thinking:

The crap is receding incrementally.

Fonts- I don’t want to put it in either, but it failed in Arduino without it.

I’ve made the changes you suggested in the .ini file and in the #includes, and none of the libraries are found- now the fonts/ library isn’t found. That was there last build.

I don’t think my PIO is executing the ‘add library’ command despite the formatting being technically correct now. The libraries folder is empty- not even a README. The pio folder is new.

lib_deps- one tab, right? My names are one tab in from the margin.
This is a Windows10 machine.

PIO itself adds Arduino. What about SPI?

This can’t be right. It’s my 901 errors:

Answered elsewhere, but:

  • The lib_deps entry is the supplier/library name;
  • The #include is the header file name.

The header name usually does not require the supplier part of the library name. Remove the Adafruit/ part from your #includes.

Cheers,
Norm.

1 Like

Thank you. I apologize for re-asking it in the new thread.

I installed the 64-bit PIO, but reinstalled with 32-bit PIO. It thinks I still have 64?

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell Install PowerShell on Windows, Linux, and macOS - PowerShell | Microsoft Learn

PS C:\Users\joema\Documents\PlatformIO\Projects\BME680_RandomNerd_WeMos> pio lib install adafruit sensor
Library Storage: C:\Users\joema\Documents\PlatformIO\Projects\BME680_RandomNerd_WeMos.pio\libdeps\wemos_d1_mini32
Library Manager: Installing adafruit
Error: Could not find the package with ‘adafruit’ requirements for your system ‘windows_amd64’

Key Error: Versions. This is elsewhere in the forum. There’s a ‘versions’ problem?
Now I have no problems, but the library will not compile because of ‘versions’. Adafruit Sensor was last modified 3 months ago, but the name is unchanged. This really seems like something that should not happen. Is it in the IDE or in the library?

Processing wemos_d1_mini32 (platform: espressif32; board: wemos_d1_mini32; framework: arduino)

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: Redirecting...
PLATFORM: Espressif 32 (2.0.0) > WeMos D1 MINI ESP32
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 → Library Dependency Finder (LDF) — PlatformIO latest documentation
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Library Manager: Installing Adafruit/Adafruit Sensor Library
    KeyError: ‘versions’:
    File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\builder\main.py”, line 169:
    env.SConscript(“$BUILD_SCRIPT”)
    File “C:\Users\joema.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py”, line 598:
    return _SConscript(self.fs, *files, **subst_kw)
    File “C:\Users\joema.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py”, line 287:
    exec(compile(scriptdata, scriptname, ‘exec’), call_stack[-1].globals)
    File “C:\Users\joema.platformio\platforms\espressif32\builder\main.py”, line 223:
    target_elf = env.BuildProgram()
    File “C:\Users\joema.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py”, line 219:
    return self.method(*nargs, **kwargs)
    File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py”, line 62:
    env.ProcessProjectDeps()
    File “C:\Users\joema.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py”, line 219:
    return self.method(*nargs, **kwargs)
    File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py”, line 140:
    project_lib_builder = env.ConfigureProjectLibBuilder()
    File “C:\Users\joema.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py”, line 219:
    return self.method(*nargs, **kwargs)
    File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py”, line 1062:
    project.install_dependencies()
    File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py”, line 898:
    lm.install(spec)
    File “c:\users\joema.platformio\penv\lib\site-packages\platformio\package\manager_install.py”, line 49:
    spec, silent=silent, skip_dependencies=skip_dependencies, force=force
    File “c:\users\joema.platformio\penv\lib\site-packages\platformio\package\manager\library.py”, line 86:
    force=force,
    File “c:\users\joema.platformio\penv\lib\site-packages\platformio\package\manager_install.py”, line 99:
    pkg = self.install_from_registry(spec, search_filters, silent=silent)
    File “c:\users\joema.platformio\penv\lib\site-packages\platformio\package\manager_registry.py”, line 86:
    version = self.pick_best_registry_version(package[“versions”], spec)
    =================================================================================================== [FAILED]

A different script that compiled a day ago, on an Uno:

Processing uno (platform: atmelavr; board: uno; framework: arduino)

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: Redirecting...
PLATFORM: Atmel AVR (2.2.0) > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (simavr) On-board (simavr)
PACKAGES:

  • framework-arduino-avr 5.0.0
  • toolchain-atmelavr 1.50400.190710 (5.4.0)
    LDF: Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Library Manager: Installing Adafruit/Adafruit GFX
    KeyError: ‘versions’:
    File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\builder\main.py”, line 169:
    env.SConscript(“$BUILD_SCRIPT”)
    File “C:\Users\joema.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py”, line 598:
    return _SConscript(self.fs, *files, **subst_kw)
    File “C:\Users\joema.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py”, line 287:
    exec(compile(scriptdata, scriptname, ‘exec’), call_stack[-1].globals)
    File “C:\Users\joema.platformio\platforms\atmelavr\builder\main.py”, line 161:
    target_elf = env.BuildProgram()
    File “C:\Users\joema.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py”, line 219:
    return self.method(*nargs, **kwargs)
    File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py”, line 62:
    env.ProcessProjectDeps()
    File “C:\Users\joema.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py”, line 219:
    return self.method(*nargs, **kwargs)
    File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py”, line 140:
    project_lib_builder = env.ConfigureProjectLibBuilder()
    File “C:\Users\joema.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py”, line 219:
    return self.method(*nargs, **kwargs)
    File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py”, line 1062:
    project.install_dependencies()
    File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py”, line 898:
    lm.install(spec)
    File “c:\users\joema.platformio\penv\lib\site-packages\platformio\package\manager_install.py”, line 49:
    spec, silent=silent, skip_dependencies=skip_dependencies, force=force
    File “c:\users\joema.platformio\penv\lib\site-packages\platformio\package\manager\library.py”, line 86:
    force=force,
    File “c:\users\joema.platformio\penv\lib\site-packages\platformio\package\manager_install.py”, line 99:
    pkg = self.install_from_registry(spec, search_filters, silent=silent)
    File “c:\users\joema.platformio\penv\lib\site-packages\platformio\package\manager_registry.py”, line 86:
    version = self.pick_best_registry_version(package[“versions”], spec)
    =================================================================================================== [FAILED]

On the command line, parameters are separated by spaces. You are passing 4 parameters to the pio command:

  1. lib
  2. install
  3. arduino
  4. sensor.

You need double quotes if a library has spaces in the name. It’s a foible of all command lines, Windows, Unix, Linux etc.

Try this:

pio lib install "adafruit sensor"

Cheerd,
Norm.

2 Likes