Pio ci error on Library examples

Hello,

I created a little library containing some communication stack.
You can find the source code here:

There are two examples with pio in the example folder.
If I open them normally and compile them, they work fine.

Now I want to do some Github Actions using pio ci.
Unfortunately building the projects fails there, because it doesn’t find the library files.

Has anyone an idea, how to fix this?

This is my first library for platformio, so I don’t have any experience with this.
Can someone with more experience have a look at the json file and the file structure and tell me, if this is correct?

Thanks and regards

You’ve already structured your examples as PlatformIO project, so you should use pio run on them (docs). If I just clone your code and do

pio run -e mzeroUSB -d examples\SAMD21Host

I get

RAM:   [=         ]   7.2% (used 2344 bytes from 32768 bytes)
Flash: [=         ]   5.8% (used 15200 bytes from 262144 bytes)
============= [SUCCESS] Took 3.78 seconds =============

Initially I also did not get it to compile with that example structure and the pio ci command – it did not find the files in the include/ directory. Probably because it’s geared towards having all example files in the same folder. If I move the two .h files from include/ directly into the src/ folder and install the to-be-tested library globally per this via pio lib -g install <path to local library download> and do

>pio ci -c examples\SAMD21Host\platformio.ini examples\SAMD21Host
============== TEST ==============
The next files/directories have been created in C:\Users\Max\AppData\Local\Temp\tmpkl62pifw
include - Put project header files here
lib - Put here project specific (private) libraries
src - Put project source files here
platformio.ini - Project Configuration File

Project has been successfully updated! Useful commands:
`pio run` - process/build project from the current directory
`pio run --target upload` or `pio run -t upload` - upload firmware to a target
`pio run --target clean` - clean project (remove compiled files)
`pio run --help` - additional information
Processing mzeroUSB (platform: atmelsam; board: mzeroUSB; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelsam/mzeroUSB.html
PLATFORM: Atmel SAM (6.0.1) > Arduino M0
HARDWARE: SAMD21G18A 48MHz, 32KB RAM, 256KB Flash
DEBUG: Current (atmel-ice) External (atmel-ice, blackmagic, jlink)
PACKAGES:
 - framework-arduino-samd 1.8.11
 - framework-cmsis 1.40500.0 (4.5.0)
 - framework-cmsis-atmel 1.2.0
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ deep, Compatibility ~ soft
Found 16 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Wire> 1.0
|-- <IndexPnpBusDriver> 1.0.0
|-- <Local>
Building in release mode
Compiling .pio\build\mzeroUSB\src\src\IndexPnPFeederHostAppl.cpp.o
[..]
Checking size .pio\build\mzeroUSB\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   7.2% (used 2344 bytes from 32768 bytes)
Flash: [=         ]   5.8% (used 15200 bytes from 262144 bytes)
=============== [SUCCESS] Took 4.00 seconds ===============

it also works though.

1 Like

Thank you very much for your answer.
I can reproduce everything you wrote on my local machine.
Unfortunately it behaves not the same on the guthub action.
It still failes, not findeing a header file. You should be able to see the error messages in the github project.

Could this be due to an difference between Windous and Linux?

Apperently you need to be signed in to see the logs, so here is the iteresting part:

Run pio run -e mzeroUSB -d ./examples/SAMD21Host
...removed some text, I can't post this many links...

Processing mzeroUSB (platform: atmelsam; board: mzeroUSB; framework: arduino)

Platform Manager: Installing atmelsam
Downloading...
Unpacking...
Platform Manager: atmelsam @ 6.0.1 has been installed!
The platform 'atmelsam' has been successfully installed!
The rest of the packages will be installed later depending on your build environment.
Tool Manager: Installing platformio/toolchain-gccarmnoneeabi @ ~1.70201.0
Downloading...
Unpacking...
Tool Manager: toolchain-gccarmnoneeabi @ 1.70201.0 has been installed!
Tool Manager: Installing platformio/framework-arduino-samd @ ~1.8.11
Downloading...
Unpacking...
Tool Manager: framework-arduino-samd @ 1.8.11 has been installed!
Tool Manager: Installing platformio/framework-cmsis @ ~1.40500.0
Downloading...
Unpacking...
Tool Manager: framework-cmsis @ 1.40500.0 has been installed!
Tool Manager: Installing platformio/framework-cmsis-atmel @ ~1.2.0
Downloading...
Unpacking...
Tool Manager: framework-cmsis-atmel @ 1.2.0 has been installed!
Tool Manager: Installing platformio/tool-scons @ ~4.40100.2
Downloading...
Unpacking...
Tool Manager: tool-scons @ 4.40100.2 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: ....docs.platformio.org/page/boards/atmelsam/mzeroUSB.html
PLATFORM: Atmel SAM (6.0.1) > Arduino M0
HARDWARE: SAMD21G18A 48MHz, 32KB RAM, 256KB Flash
DEBUG: Current (atmel-ice) External (atmel-ice, blackmagic, jlink)

PACKAGES:

- framework-arduino-samd 1.8.11 
 - framework-cmsis 1.40500.0 (4.5.0) 
 - framework-cmsis-atmel 1.2.0 
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ deep, Compatibility ~ soft
Found 13 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <IndexPnpBusDriver> 1.0.0
Building in release mode
Compiling .pio/build/mzeroUSB/src/src/IndexPnPFeederHostAppl.cpp.o
Compiling .pio/build/mzeroUSB/src/src/arduinoHelpers.cpp.o
In file included from /home/runner/work/IndexPnpBusDriver/IndexPnpBusDriver/include/IndexPnpBusInterface.h:29:0,
             from src/IndexPnPFeederHostAppl.h:29,
             from src/IndexPnPFeederHostAppl.cpp:25:
/home/runner/work/IndexPnpBusDriver/IndexPnpBusDriver/include/IndexPnpBusPdu.h:30:10: fatal error: IndexPnPBusEnums.h: No such file or directory

**************************************************************************
* Looking for IndexPnPBusEnums.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:IndexPnPBusEnums.h"
* Web  > 
*
**************************************************************************

 #include "IndexPnPBusEnums.h"
      ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio/build/mzeroUSB/src/src/IndexPnPFeederHostAppl.cpp.o] Error 1
========================= [FAILED] Took 27.59 seconds =========================
Error: Process completed with exit code 1.