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

BuildDependentLibraries ignores src_filter #570

Closed
maru-sama opened this issue Mar 10, 2016 · 8 comments
Closed

BuildDependentLibraries ignores src_filter #570

maru-sama opened this issue Mar 10, 2016 · 8 comments
Assignees
Labels
enhancement ldf Library Dependency Finder
Milestone

Comments

@maru-sama
Copy link

I recently started using the src_filter directive to create two different firmwares in one project. Both of them are running on the same platform but have a different functionality and use different libraries. While compiling one of the environments I noticed that Libraries were compiled which were referenced in the other main file but not in the current file. Looking at https://github.com/platformio/platformio/blob/4c4682f45709ad54da5293eb654bff9bbcc05c44/platformio/builder/tools/platformio.py#L224 I saw that BuildDependentLibraries apparently does not use src_filter. While this does not affect the final firmware binary it increases the build time.

[env:display]
platform = espressif
framework = arduino
board = huzzah
upload_speed = 921600
upload_port = "ESP8266-Lights.local"
src_filter = "+<display>"

[env:trigger]
platform = espressif
framework = arduino
board = huzzah
upload_speed = 921600
upload_port = "ESP8266-Trigger.local"
src_filter = "+<trigger>"

If I compile trigger here the main.cpp file in display is actually parsed as well and all the libs referenced there are also build, although they are not referenced in the main.cpp file inside trigger.

@ivankravets
Copy link
Member

Do you mean this functionality #289?

@maru-sama
Copy link
Author

I do not think it is related. Let me try to explain this in more detail. In the above example I have to folders below src with one main.cpp file each. I used src_filter to be able to select the main.cpp file I want to compile and this works quite well. The main.cpp files are using different libraries. the one in display is using the FastLed library for example. If I now build the trigger environment which is NOT using the fastled library it is still being compiled during the build process. I think the reason for this is that BuildDependentLibraries is looking at ALL files in the source folder, finds both main.cpp files, extracts the includes and then builds the libraries.

@ivankravets ivankravets added this to the 2.8.6 milestone Mar 10, 2016
@ivankravets
Copy link
Member

@maru-sama Thanks, I got you now. This is a bug.

@ivankravets
Copy link
Member

I want to note that if library is not used in source code but IS BUILT and LINKED, GCC Linker will ignore it because there doesn't exist any reference to it.

Of course, PlatformIO should ignore them. I mean that your code should work well with the current version of PlatformIO.

@maru-sama
Copy link
Author

I had a look at the linking command and apparently it is not linked in either. So apparently this logic is fine as well. Right now this is really only affecting the build-time.

@ivankravets ivankravets added the ldf Library Dependency Finder label Mar 10, 2016
@ivankravets ivankravets modified the milestones: 3.0.0, 2.8.6 Mar 10, 2016
@ivankravets
Copy link
Member

I've just changed it to "enhancement" and will fix together with the rest lib-related issues in PlatformIO 3.0. PlatformIO 2.0 is very stable and I don't want to break it. Library Dependencies Finder (LDF) has complicated logic.

@maru-sama
Copy link
Author

Perfect

@ivankravets ivankravets mentioned this issue Mar 19, 2016
37 tasks
@ivankravets
Copy link
Member

Resolved in f8db1d1

ivankravets added a commit that referenced this issue Sep 9, 2016
* develop:
  Fix incorrect line order when converting from INO to CPP and pointer is used
  Fix unit test
  Notify about `version` field when creating library
  Add support for SparkFun Blynk Board
  Return valid exit code from ``plaformio test`` command
  Disable SSL Server-Name-Indication for Python < 2.7.9
  Version bump to 3.0.1 (issue #772)
  Disable temporary SSL for PlatformIO services // Resolve #772
  Version bump to 3.0.0 (issues #770, #766, #747, #730, #765, #640, #659, #742, #459, #542, #763, #759, #753, #757, #749, #748, #745, #519, #709, #743, #413, #498, #410, #740, #361, #414, #554, #732, #588, #475, #461, #101, #719, #721, #537, #415, #522, #289, #556, #570, #456, #617, #432, #408, #479, #667, #510)
  Fix menu height for  docs
  Fix issue with multiple archives when linking firmware
  Add migration guide for PIO2 to PIO3
  Search libraries by headers/includes with ``platformio lib search --header`` option
  Update pio run command examples
  Add Unit Testing Demo
  Update PIO Plus badge title and link
  Add PlatformIO Plus badge
  Add links to PlatformIO Plus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ldf Library Dependency Finder
Projects
None yet
Development

No branches or pull requests

3 participants