Skip to content

Multiple libraries warning when platform overrides builtin library #37

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

Closed
PaulStoffregen opened this issue Oct 29, 2015 · 1 comment
Closed
Milestone

Comments

@PaulStoffregen
Copy link

The multiple libraries warning is working, but working too much in some cases.

For example, when compiling any Servo library example on Teensy: (tested with the latest hourly build)

Multiple libraries were found for "Servo.h"
 Used: /tmp/arduino-nightly/hardware/teensy/avr/libraries/Servo
 Not used: /tmp/arduino-nightly/libraries/Servo

While harmless, this should not be cause to alert (and distract) end users. It's perfectly normal for other platforms to override libraries like Servo, which contain code only for specific timers on Atmel chips.

The builder does seem to be properly choosing the platform library over the builtin copy, which is good. Please consider suppressing this warning message for the case where the duplicate was between only 1 copy in the platform folder and 1 copy in the builtin libraries.

Warning message (in red) become much less meaningful to end users if they appear in normal cases that aren't cause for any concern.

@ffissore ffissore modified the milestone: 1.0.3 Oct 29, 2015
@ffissore ffissore self-assigned this Oct 29, 2015
matthijskooijman added a commit to matthijskooijman/arduino-builder that referenced this issue May 18, 2016
…" again

This reverts commit 2058479:

	Adding info in LibraryResolutionResult about whether selected
	library comes from a platform or from outside. If the former and
	there are duplicates, no warning is printed

Additionally, the librariesInSomePlatform function and
librariesInPlatforms variable in resolveLibrary are removed, since these
are now unused.

The original suggestion in arduino#37 was that if a platform library overrides
a builtin library, no warning would be needed. The implementation,
however, was hiding the warning whenever a platform library was
overriding any other library, including a user library, which seems
harmful (This was [reported on the devlist][1]).

This commit reverts the exception added for arduino#37, making the warning
appear unconditionally again. In a future commit, a better solution
for arduino#37 will be added.

[1]: https://groups.google.com/a/arduino.cc/d/msg/developers/1kkIqIsbuzU/0-abwr1gBQAJ

Signed-off-by: Matthijs Kooijman <[email protected]>
matthijskooijman added a commit to matthijskooijman/arduino-builder that referenced this issue May 18, 2016
Previously, this warning was always printed when multiple libraries were
found for a header filename. arduino#37 reported that this can be confusing for
novice users, when for example a platform library overrides a builtin
library, which is typically considered "normal" and should not generate
a warning.

The previous attempt at fixing arduino#37 (which was reverted) would hide the
warning in these "normal" cases, but it ended up also hiding the message
in cases where it would be relevant (as [reported on the mailing
list][1]). Also, if for a single compilation some of these messages are
hidden, but others are not, this might cause users to draw incorrect
conclusions if they are not aware of the exceptions ("there must be only
one library for this header file, since I didn't see any message").

This commit takes a different approach: these messages are only shown when:
 - The sketch fails to compile. In this case, the message is emitted as a
   warning, shown in red in the IDE.
 - Verbose compilation is enabled. In this case, the message is emitted
   as informational, shown in white in the IDE.

This means that these message are either *all* shown, or *none* of them
are shown, which should make the behaviour more predictable. There is
still a chance that the "normal" messages described in arduino#37 confuse a
novice user when there is a compilation error completely unrelated to
the chosen libraries, but it is pretty impossible for arduino-builder to
know the cause of a failed compilation, so just showing all of these
messages on an error seems the best approach.

This fixes arduino#37 (again).

[1]: https://groups.google.com/a/arduino.cc/d/msg/developers/1kkIqIsbuzU/0-abwr1gBQAJ

Signed-off-by: Matthijs Kooijman <[email protected]>
@matthijskooijman
Copy link
Collaborator

#151 changes the way this issue is fixed, since the current fix has some issues. @PaulStoffregen, care to have a look at #151 and see what you think? I think @cmaglie is planning to merge it Real Soon, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants