PlatformIO Community

Private Lib not found since latest update

I recently updated PlatformIO and Cmake (3.16 minimum was required). Since then linker doesn’t seem to see my lib.

Processing esp32doit-devkit-v1 (platform: espressif32; board: esp32doit-devkit-v1; framework: espidf)
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: Espressif 32 1.12.0 > DOIT ESP32 DEVKIT V1
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)
 - framework-espidf 3.40000.200303 (4.0.0) 
 - tool-cmake 3.16.4 
 - tool-esptoolpy 1.20600.0 (2.6.0) 
 - tool-ninja 1.7.1 
 - toolchain-esp32ulp 1.22851.190618 (2.28.51) 
 - toolchain-xtensa32 2.80200.200226 (8.2.0)
Reading CMake configuration...
LDF: Library Dependency Finder ->
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/esp32doit-devkit-v1/esp-idf/src/main.c.o
Generating LD script .pio/build/esp32doit-devkit-v1/esp32_out.ld
Generating partitions .pio/build/esp32doit-devkit-v1/partitions.bin
Compiling .pio/build/esp32doit-devkit-v1/esp-idf/spi_flash/partition.c.o
Compiling .pio/build/esp32doit-devkit-v1/esp-idf/spi_flash/spi_flash_rom_patch.c.o
src/main.c:8:10: fatal error: lighting.h: No such file or directory

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

 #include <lighting.h>
compilation terminated.
Compiling .pio/build/esp32doit-devkit-v1/esp-idf/spi_flash/spi_flash_chip_drivers.c.o
*** [.pio/build/esp32doit-devkit-v1/esp-idf/src/main.c.o] Error 1

I’ve linked a simple code just to isolate the issue.

Thanks :slight_smile:

Hi @Gabriel47! Looks like a bug, could you please try to organize your library as a full-fledged ESP-IDF component?
Just create a new CMakeLists.txt in library folder with the following contents:

idf_component_register(SRCS "lighting.c" INCLUDE_DIRS ".")

Then specify it in the main CMakeLists.txt near platformio.ini:

cmake_minimum_required(VERSION 3.16.0)

@valeros looking at your example you show in your comment, are you saying i need this in the library folder or in the main src folder?
idf_component_registers(SRCS "lighting.c" INCLUDE_DIRS ".")

Hi @wegunterjr! This problem should be fixed is the latest version of the platform, so there is no need to specify it as a component if it’s a basic library, just put it in the lib folder.

1 Like