platformio/platformio-core

Library with `libCompatMode: strict` is not actually being strict

Open

#5.171 aberto em 29 de mai. de 2025

Ver no GitHub
 (1 comment) (0 reactions) (0 assignees)Python (791 forks)batch import
LDFhelp wanted

Métricas do repositório

Stars
 (7.329 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

I have a problem during build of espressif32 platform where a library with libCompatMode of strict still tries to build other platforms code. I have to set lib_compat_mode in projects platformio.ini to work around this, but I would expect that libCompatMode would set strict mode for all dependencies of my library.

See here:

project/lib/esp32-common-lib/library.json

{
  "$schema": "https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/schema/library.json",
  "name": "esp32-common-lib",
  "version": "1.0.0",
  "license": "private",
  "frameworks": [
    "arduino"
  ],
  "platforms": [
    "espressif32"
  ],
  "dependencies": [
    {
      "owner": "greiman",
      "name": "SdFat",
      "version": "^2.2.0"
    },
    {
      "owner": "bblanchon",
      "name": "ArduinoJson",
      "version": "^7.0.0"
    },
    {
      "owner": "Links2004",
      "name": "WebSockets",
      "version": "^2.3.6"
    },
    {
      "owner": "esp32async",
      "name": "ESPAsyncWebServer",
      "version": "^3.7.7",
      "platforms": ["espressif32"]
    }
  ],
  "build": {
    "libCompatMode": "strict"
  }
}

The problem is RPAsyncTCP, a dependency of ESPAsyncWebServer. (ESPAsyncWebServer does not have strict libCompatMode enabled)

project/platformio.ini

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
board_build.filesystem = littlefs
lib_deps = xreef/PCF8574 library@^2.3.7
; Uncomment following line to workaround this bug
; lib_compat_mode = strict

Guia do colaborador