PlatformIO Community

Library compatibility problems

Hello,

I’m trying to write the Adafruit ADXL343 demo sketch (https://github.com/adafruit/Adafruit_ADXL343/blob/master/examples/sensortest/sensortest.ino) to an Adafruit Metro Mini, which is basically equivalent to an Arduino Uno.

My platformio.ini looks like this:

[env:uno]
platform = atmelavr
board = uno
board_build.mcu = atmega328p
;lib_compat_mode = off
;lib_ldf_mode = deep+
lib_deps = 
  adafruit/Adafruit ADXL343
  adafruit/Adafruit Unified Sensor

While the resolver does find and download relevant libraries, during a run attempt it disregards them as incompatible:

$ bin/pio run -v
Processing uno (platform: atmelavr; board: uno; board_build.mcu: atmega328p; lib_deps: adafruit/Adafruit ADXL343, adafruit/Adafruit Unified Sensor)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR (4.0.0) > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (avr-stub) On-board (avr-stub, simavr)
PACKAGES: 
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Framework incompatible library /[...]/.pio/libdeps/uno/Adafruit ADXL343
Framework incompatible library /[...]/.pio/libdeps/uno/Adafruit BusIO
Framework incompatible library /[...]/.pio/libdeps/uno/Adafruit Unified Sensor
More details about "Library Compatibility Mode": https://docs.platformio.org/page/librarymanager/ldf.html#ldf-compat-mode
Found 1 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
avr-gcc -o .pio/build/uno/src/main.o -c -std=gnu11 -fno-fat-lto-objects -mmcu=atmega328p -Os -Wall -ffunction-sections -fdata-sections -flto -DF_CPU=16000000L -DPLATFORMIO=60103 -DARDUINO_AVR_UNO -Iinclude -Isrc src/main.c
src/main.c:1:10: fatal error: Adafruit_Sensor.h: No such file or directory

However, the library.properties file in those library directories don’t appear to specify any limitation (they show architectures=*, but I don’t know if that’s relevant).
Changing the compat_mode and ldf_mode settings don’t cause it to find those libraries acceptable.

Am I missing something? Switching to Windows and the Arduino IDE, I was able to flash the sketch successfully, so I think these libraries should be compatible.

There’s no

framework = arduino

in the platformio.ini? But all the libraries you reference need this as a base framework.

This (and incorrectly naming my source file .c instead of .cpp) was it. Thank you!