RPI platformIO - confiugration, libraries path

I’m trying to move platformIO into RPI to use CMD interface.

I have an issue with libraries - a test which I made is failing.

  • I’ve initialized new project
  • installed a library under ~/.platformio/lib

but when trying to compile sketch its failing because of lake of library

src/main.cpp:2:32: fatal error: ApplicationMonitor.h: No such file or directory
#include <ApplicationMonitor.h>
compilation terminated.
scons: *** [.pioenvs/megaatmega2560/src/main.o] Error 1

what em I missing ?
thanks in advance

See examples how libraries should be organized:

I have fallowed one example which works on my local machine but not working on RPI - still platform IO do not see external libraries

Example sketch uses OneWire.h so I have installed
platformio lib search OneWire
platformio lib install 1

and now example is compaling on my local laptop but on RPI I still see an error
src/DS18x20_Temperature.cpp:2:21: fatal error: OneWire.h: No such file or directory
include OneWire.h

in addition after lib instalation I can see that lib in RPI under /home/pi/.platformio/lib - but because of some reason platformIO do not see that during compilation

Please give me an output of this command from RPi

pio lib list

P.S: Don’t forget to run pio without sudo.

output seems to be empty (but on my local machine also is empty and libs works)
pi@pi ~/.platformio/lib $ sudo platformio lib list
pi@pi ~/.platformio/lib $ pwd
pi@pi ~/.platformio/lib $ ll
total 16
drwxr-xr-x 2 root root 4096 Jun 26 11:06 ApplicationMonitor
drwx------ 3 pi pi 4096 Jun 26 11:57 Button_ID77
drwx------ 3 pi pi 4096 Jun 26 15:44 OneWire_ID1
drwx------ 4 pi pi 4096 Jun 26 11:05 U8glib_ID7

Why do you use sudo? PlatformIO uses HOME_DIR by default for the place where to install libs and packages. If you run with sudo, then the home directory is SUPER USER (not pi).

Please don’t use sudo.

You are right - so here is an output

`pi@pi ~/.platformio/lib $ platformio lib list
[ ID ] Name Compatibility “Authors”: Description

[ 1 ] OneWire arduino “Paul Stoffregen, Jim Studt, Tom Pollard, Derek Yerger, Josh Larios, Robin James, Glenn Trewitt, Jason Dangel, Guillermo Lovato, Ken Butcher, Mark Tillotson, Bertrik Sikken, Scott Roberts”: Control 1-Wire protocol (DS18S20, DS18B20, DS2408 and etc)
[ 7 ] U8glib arduino, atmelavr “Oliver Kraus”: Universal Graphics Library for 8 Bit Embedded Systems (SSD1325, ST7565, ST7920, UC1608, UC1610, UC1701, PCD8544, PCF8812, KS0108, LC7981, SBN1661, SSD1306, T6963, LD7032)
[ 77 ] Button arduino, atmelavr “Jack Christensen”: Arduino library to debounce button switches, detect presses, releases, and long presses

  1. Remove .pioenvs directory from the project (it seems that after your mistake this folder now is under root)
  2. Try platformio run WITHOUT sudo.


So I think that was also the reason of platformio run failure.
WIthout sudo I saw error like:
Error: Invalid value for “–project-dir” / “-d”: Directory “/home/pi/arduino/test2/platformio-examples-develop/atmelavr-and-arduino/arduino-external-libs” is not writable.

I have changed privileges and platformio run run well :slight_smile:

Another question does that have to be installed in each new project ?
The platform ‘atmelavr’ has not been installed yet. Would you like to install it now? [y/N]: y

It will be installed once. As I’ve said above, all libs and packages were installed to root’s home directory. See docs Redirecting...

Many thanks for quick feedback.

Happy Coding with PlatformIO! :slight_smile: