Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib_compat_mode=off is ineffective #2867

Closed
sarfata opened this issue Aug 4, 2019 · 6 comments

Comments

@sarfata
Copy link

commented Aug 4, 2019

What kind of issue is this?

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

Configuration

Operating system: macOS 10.14.5

PlatformIO Version (platformio --version): 4.0.0

Description of problem

The lib_compat_mode=off option is not respected. Incompatible libraries are still rejected.

Steps to Reproduce

$ platformio init
$ cat > platformio.ini
[global]
lib_compat_mode = off

[env:kbox32]
platform = https://github.com/platformio/platform-espressif32.git
framework = espidf
board = esp32dev
build_flags = -DKBOX32_SSID=\"YOURWIFI\" -DKBOX32_PASSWORD=\"YOURWIFIPASSWORD\" -fexceptions
lib_compat_mode = off

cat > src/main.cpp
#include <AsyncTCP.h>

int main()
{
  return 0
}

$ platformio run -vv

Actual Results

Processing project (platform: espressif32; lib_deps: AsyncTCP; lib_compat_mode: off; board: esp32dev; framework: espidf)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 1.9.0 #2c1b430 (git+https://github.com/platformio/platform-espressif32.git) > Espressif ESP32 Dev Module
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)
PACKAGES: toolchain-xtensa32 2.50200.80 (5.2.0), framework-espidf 3.30202.190627 (3.2.2), tool-esptoolpy 1.20600.0 (2.6.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ off
Framework incompatible library /Users/thomas/Desktop/testcompat/.pio/libdeps/project/AsyncTCP_ID1826
More details about "Library Compatibility Mode": https://docs.platformio.org/page/librarymanager/ldf.html#ldf-compat-mode
Found 0 compatible libraries

Expected Results

The library should be included in the compilation.

This is what the documentation says:

  • off: | Does not check for compatibility (is not recommended)
  • soft: [DEFAULT] Checks for the compatibility with framework from build environment
  • strict: Checks for the compatibility with framework and platform from build environment.

This mode can be changed using lib_compat_mode option in “platformio.ini” (Project Configuration File). Default value is set to soft.

@pfeerick

This comment has been minimized.

Copy link
Contributor

commented Aug 5, 2019

It sort of is and isn't working... the library has libCompatMode set to 2, so strict, which is overriding what is set in platformio.ini ...

image

It seems like the checks that happen here get overridden by the library settings if present...

def IsCompatibleLibBuilder(env,
lb,
verbose=int(ARGUMENTS.get("PIOVERBOSE", 0))):
compat_mode = lb.lib_compat_mode
if lb.name in env.GetProjectOption("lib_ignore", []):
if verbose:
sys.stderr.write("Ignored library %s\n" % lb.path)
return None
if compat_mode == "strict" and not lb.is_platforms_compatible(
env['PIOPLATFORM']):
if verbose:
sys.stderr.write("Platform incompatible library %s\n" % lb.path)
return False
if (compat_mode in ("soft", "strict") and "PIOFRAMEWORK" in env
and not lb.is_frameworks_compatible(env.get("PIOFRAMEWORK", []))):
if verbose:
sys.stderr.write("Framework incompatible library %s\n" % lb.path)
return False
return True

... which isn't the behavior I would have expected...

@sarfata

This comment has been minimized.

Copy link
Author

commented Aug 7, 2019

@pfeerick thanks for looking into this!

@ivankravets ivankravets added this to the 4.0.1 milestone Aug 19, 2019

@ivankravets

This comment has been minimized.

Copy link
Member

commented Aug 19, 2019

Thanks for the report! Please re-test with pio upgrade --dev.

@sarfata

This comment has been minimized.

Copy link
Author

commented Aug 21, 2019

Looks good to me! Thanks for fixing this!

@ivankravets ivankravets referenced this issue Aug 22, 2019
5 of 5 tasks complete
@mcspr

This comment has been minimized.

Copy link

commented Aug 23, 2019

42ee6fe seems to break ESPAsyncWebServer builds with esp8266
https://travis-ci.org/xoseperez/espurna/jobs/575774509#L515
pio run -v shows AsyncTCP (esp32 library) as a dependency, which it tries to build instead of ignoring.

I found a typo mcspr@fbf9146 (edit: fix github magic converting fork commits into this repo commits)
But I think that needs a proper test attached too... or a different method of finding out the default, bc mode == "strict" check will fail to invalidate the dependency

> print(validate_compat_mode('deep'))
soft
> print(validate_ldf_mode('strict'))
chain
@ivankravets

This comment has been minimized.

Copy link
Member

commented Aug 23, 2019

@mcspr thanks again for your reports! They are so valuable. See related issue #2940

It's my typo :-( Need to better cover with tests LDF or add to our CI a few popular projects, such as ESPurna.

The PIO Core 4.0.2 is going to be released in the next 10-15 minutes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.