platformio/platformio-core

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

Open

#5 171 ouverte le 29 mai 2025

Voir sur GitHub
 (1 commentaire) (0 réactions) (0 assignés)Python (791 forks)batch import
LDFhelp wanted

Métriques du dépôt

Stars
 (7 329 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

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

Guide contributeur