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

LDF chain+ and deep+ in atmelavr platform include spurious Robot Control library #1930

Closed
1 of 5 tasks
conklech opened this issue Nov 17, 2018 · 7 comments
Closed
1 of 5 tasks
Labels
Milestone

Comments

@conklech
Copy link

conklech commented Nov 17, 2018

What kind of issue is this?

  • Question.
    This issue tracker is not the place for questions. If you want to ask how to do something,
    or to understand why something isn't working the way you expect it to,
    use Community Forums or Premium Support

  • PlatformIO IDE.
    All issues related to PlatformIO IDE should be reported to appropriate repository:
    PlatformIO IDE for Atom or
    PlatformIO IDE for VSCode

  • Development Platform or Board.
    All issues (building, uploading, adding new boards, etc.) related to PlatformIO development platforms
    should be reported to appropriate repository related to your hardware
    https://github.com/topics/platformio-platform

  • Feature Request.
    Start by telling us what problem you’re trying to solve. Often a solution
    already exists! Don’t send pull requests to implement new features without first getting our
    support. Sometimes we leave features out on purpose to keep the project small.

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

You can erase any parts of this template not applicable to your Issue.


Configuration

Operating system:

Windows 10

PlatformIO Version (platformio --version):

3.6.2a2, through VSCode plugin

Description of problem

A minimal test case is linked below.

Steps to Reproduce

  1. Create new project using atmelavr platform, arduino framework. I used megaatmega2560 board.
  2. Add lib_ldf_mode = chain+ or lib_ldf_mode = deep+ to platformio.ini.
  3. Add #include <SD.h> to main.cpp
  4. Build.

Actual Results

LDF erroneously determines that SD library depends on Robot Control library. Build fails because Robot Control cannot be built.

Full output, with modified project files

Relevant portion of output:

Dependency Graph
|-- <SD> 1.1.1 (C:\Users\chris\.platformio\packages\framework-arduinoavr\libraries\SD)
|   |-- <Robot Control> 1.0.3 (C:\Users\chris\.platformio\packages\framework-arduinoavr\libraries\Robot_Control)
|   |   |-- <SPI> 1.0 (C:\Users\chris\.platformio\packages\framework-arduinoavr\libraries\__cores__\arduino\SPI)
|   |   |-- <Wire> 1.0 (C:\Users\chris\.platformio\packages\framework-arduinoavr\libraries\__cores__\arduino\Wire)

and

avr-g++ -o .pioenvs\megaatmega2560\libf55\Robot_Control\Arduino_LCD.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -IC:\Users\chris\.platformio\packages\framework-arduinoavr\cores\arduino -IC:\Users\chris\.platformio\packages\framework-arduinoavr\variants\mega -IC:\Users\chris\.platformio\packages\framework-arduinoavr\libraries\__cores__\arduino\SPI\src
-IC:\Users\chris\.platformio\packages\framework-arduinoavr\libraries\__cores__\arduino\Wire\src -IC:\Users\chris\.platformio\packages\framework-arduinoavr\libraries\Robot_Control\src C:\Users\chris\.platformio\packages\framework-arduinoavr\libraries\Robot_Control\src\Arduino_LCD.cpp
C:\Users\chris\.platformio\packages\framework-arduinoavr\libraries\Robot_Control\src\ArduinoRobot.cpp: In constructor 'RobotControl::RobotControl()':
C:\Users\chris\.platformio\packages\framework-arduinoavr\libraries\Robot_Control\src\ArduinoRobot.cpp:26:42: error: 'LCD_CS' was not declared in this scope
RobotControl::RobotControl():Arduino_LCD(LCD_CS,DC_LCD,RST_LCD){
^

leading to build failure.

Expected Results

Build succeeds; LDF determines that library SD depends on library SPI, not on Robot Control.

Dependency Graph
|-- <SD> 1.1.1 (C:\Users\chris\.platformio\packages\framework-arduinoavr\libraries\SD)
|   |-- <SPI> 1.0 (C:\Users\chris\.platformio\packages\framework-arduinoavr\libraries\__cores__\arduino\SPI)

Changing to chain or deep LDF mode results in successful build, so this seems related to the CPP functionality implied by +.

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:megaatmega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino
lib_ldf_mode = deep+

Source file to reproduce issue:

#include <Arduino.h>
#include <SD.h> // Adding this include triggers inclusion of Robot_Control with deep+ library dependency resolution

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
}

Additional info

@conklech conklech changed the title LDF chain+ and deep+ in atmelavr platform include spurious Robot_Control library LDF chain+ and deep+ in atmelavr platform include spurious Robot Control library Nov 17, 2018
@conklech
Copy link
Author

It looks like a similar or related bug was reported and fixed back in 2016: https://community.platformio.org/t/v3-framework-arduinoteensy-minimal-project-fails-to-build/548

@ivankravets ivankravets added this to the 3.6.2 milestone Nov 19, 2018
@ivankravets
Copy link
Member

Thanks for the report! Please re-test with the latest development version via

$ pio upgrade --dev

@conklech
Copy link
Author

conklech commented Nov 19, 2018

After updating with pio upgrade --dev (to reported version 3.6.2b2) I no longer get the spurious dependency, but get the following warnings for every file when building with verbose with either chain+ or deep+. It's not immediately obvious to me whether this is relevant/significant (i.e. I don't have a test case handy to determine whether these messages mean "not using -+ mode"). Filename replaced with *** for conciseness:

Warning! Classic Pre Processor is used for `****`, advanced has failed with `'tuple' object has no attribute 'add'`

If you'd like additional testing/investigation, let me know. Thanks!

@ivankravets
Copy link
Member

Please run pio upgrade --dev again. Sorry.

@conklech
Copy link
Author

conklech commented Nov 20, 2018

Running into a different error with the same minimal case now. Here's a gist of the output, with the error case (deep+) as the second file and the succeeding case (deep) as the first.. Same build inputs as in the original report, i.e. just #include <SD.h>.

Here it's compiling something that it should (Sd2Card.cpp, a dependency of the SD library), but it's not populating the include path correctly for some reason.

Thanks again for the continuing support!

@ivankravets
Copy link
Member

Wow! It's a very interesting bug in @SCons. We have fixed in platformio/scons@04bf778

Please re-run pio upgrade --dev again.

@conklech
Copy link
Author

Fix confirmed.

ivankravets added a commit that referenced this issue Nov 24, 2018
* develop: (31 commits)
  Document "erase" target
  Docs: Grammar fixes
  Bump version to 3.6.2b5
  Improved IntelliSense for PlatformIO IDE for VSCode via passing extra compiler information for C/C++ Code Parser
  Bump version to 3.6.2b4
  LDF: Stop handling "define" and "undef" when condition fails; handle CPP files in "chain+" and "deep+" modes // Resolve #1930
  Bump version to 3.6.2b3
  Handle CWD when searching for a file // Resolve #1930
  Document in `library.json` how to pass flags to a global build environment
  Bump version to 3.6.2b2
  Fix an issue when Library Dependency Finder (LDF) finds spurious dependencies in ``chain+`` and ``deep+`` modes // Resolve #1930
  Fix an issue when Library Dependency Finder (LDF) does not handle project `src_filter ` // Resolve #1905
  Bump version to 3.6.2b1
  Prepend CPPATH of library dependencies instead of appending // Resolve #1914
  Bump version to 3.6.2a3
  Go over 8010-8100 TCP ports when shutting down PIO Home server
  Docs: Add support for OLIMEX ESP32-PRO
  Rename "System" to "Hardware" for board spec
  Add info about "EN" pin for ESP32 and debug probes
  Fix pinouts for oddWires IOT-Bus JTAG
  ...

# Conflicts:
#	platformio/__init__.py
#	platformio/managers/core.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants