question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Library Dependency Finder includes commented out libraries

See original GitHub issue

Configuration

Operating system: Windows 10 x64

PlatformIO Version : PlatformIO, version 4.3.4 + VS Code 1.46.0

Description of problem

I’ve found what I think is a bug. If I comment out an #include with library in one-line block comment (e.g. /*#include <EEPROM.h>*/), the library gets removed from Dependecy graph. This is correct behavior.

However, if I comment the #include with a multiline block comment like this:

/*
 #include <EEPROM.h>
*/

then the library still ends up in dependency graph, gets compiled etc.

Steps to Reproduce

  1. Create a simple project. I used an Arduino framework for Arduino Uno board. Leave all settings as default.
  2. Try the following code in main.cpp:
#include <Arduino.h>

/* #include <EEPROM.h> */

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

void loop() {
  // put your main code here, to run repeatedly:
}
  1. Build. The output includes lines
Scanning dependencies...
No dependencies
  1. Now try another code (only 2 newlines added):
#include <Arduino.h>

/* 
#include <EEPROM.h> 
*/

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

void loop() {
  // put your main code here, to run repeatedly:
}
  1. Build. This time the library gets included in build:
Scanning dependencies...
Dependency Graph
|-- <EEPROM> 2.0

Expected Results

In both cases the library should not be included in build.

Additional info

I’m using PIO from VS Code and installed all stuff via VS Code.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
TD-ercommented, Jul 2, 2020

Just for reference: docs.platformio.org - ldf-mode

I will try to use the chain+ mode. But in the past I have also looked into this and then the chain+ mode (or the deep(+) mode) had some issues. Sadly I don’t remember what those were.

1reaction
Misiucommented, Jul 2, 2020

@TD-er not sure if this help, but I created a quick test and I’ve added lib_ldf_mode = chain+ to platform.ini.

main.cpp:

#include <Arduino.h>

#ifdef USE_LITTLEFS
#include <FS.h>
#include <LittleFS.h>
#else
#include <FS.h>
#endif

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

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

platform.ini file:

[env:d1_mini]
platform = espressif8266
board = d1_mini
framework = arduino
build_flags = -D USE_LITTLEFS
lib_ldf_mode = chain+

result: image

platform.ini:

[env:d1_mini]
platform = espressif8266
board = d1_mini
framework = arduino
build_flags = -D NOT_USE_LITTLEFS; this has changed
lib_ldf_mode = chain+

image

I hope this helps 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

Library Dependency Finder (LDF) - Platformio Docs
[DEFAULT] Parses ALL C/C++ source files of the project and follows only by nested includes ( #include ... , chain...) from the libraries....
Read more >
How to find out where a Maven dependency comes from
Need to know exactly which libraries and dependencies your Java project is using? Maven knows that. Here's how find out.
Read more >
Check if Library is used in Android app - Stack Overflow
Comment out all dependencies and check what fails (see below) ... Finding libraries and resources used in an Android app comes up in...
Read more >
Find usages of classes from maven dependency
Hi, Is there a way I can find usages of classes from a maven dependency? I could comment out a dependency and launch...
Read more >
4.1. Quickstart — Cabal 3.4.0.0 User's Guide
One of the important questions is whether the package contains a library and/or an executable. Libraries are collections of Haskell modules that can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found