Skip to content

0.13.0 does not find include file, 0.12.1 does #960

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
ArminJo opened this issue Sep 20, 2020 · 5 comments · Fixed by #987
Closed

0.13.0 does not find include file, 0.12.1 does #960

ArminJo opened this issue Sep 20, 2020 · 5 comments · Fixed by #987

Comments

@ArminJo
Copy link

ArminJo commented Sep 20, 2020

Bug Report

Here the error

/home/runner/work/ServoEasing/ServoEasing/examples/LightweightServoExample/LightweightServoExample.ino:28:10: fatal error: LightweightServo.h: No such file or directory
 #include "LightweightServo.h"

is with cli 13.0

This is the same situation, the only change is the different cli version 12.1

@per1234
Copy link
Contributor

per1234 commented Sep 20, 2020

Thanks for the report @ArminJo!

Here's a more minimal demonstration of the bug:

$ arduino-cli lib install Ethernet  >/dev/null
$ mkdir /tmp/Foo
$ printf "#include <EthernetUdp.h>\nvoid setup() {}\nvoid loop() {}\n" > /tmp/Foo/Foo.ino
$ arduino-cli compile -b arduino:avr:uno /tmp/Foo
C:\Users\per\AppData\Local\Temp\Foo\Foo.ino:1:10: fatal error: EthernetUdp.h: No such file or directory
 #include <EthernetUdp.h>
          ^~~~~~~~~~~~~~~
compilation terminated.
Error during build: exit status 1

There is a bug in the way the includes field of library.properties works. Even though that field is only intended to customize the #include directives inserted into the currently open sketch by the Arduino IDE's Sketch > Include Library feature, what it now does is actually defines the header files visible to Arduino CLI's library discovery system!

The bug was introduced by e6f1947

The ServoEasing library has this includes field:
https://github.com/ArminJo/ServoEasing/blob/4436e46e211c0f5e445c5b4d57b9c142b382b552/library.properties#L9

includes=ServoEasing.h

The example sketches that are compiling in your CI run are those that use ServoEasing.h in their #include directives.

The example sketch that fails is the one using LightweightServo.h in its #include directive, because this file does not match the includes field in library.properties.

@ArminJo
Copy link
Author

ArminJo commented Sep 20, 2020

Thanks a lot per1234 🥇
I checked the specification, but there was no note about the new behavior.
But I can live with it, I deleted the includes field. 😉
Thanks again and have a nice weekend.
Armin

@ArminJo ArminJo closed this as completed Sep 20, 2020
@per1234
Copy link
Contributor

per1234 commented Sep 27, 2020

@ArminJo I hope you won't mind that I reopen this.

We should use this issue to track the bug until the issue has been resolved.

Even if this was an intentional change, it would need to be clearly documented in the library specification and the 0.13.0 release notes. So, no matter what, some action needs to be taken and we may forget about it without an open issue.

@Legion2
Copy link

Legion2 commented Sep 27, 2020

Ok, when this was an intended change what is now the purpose of the include field in the library.properties file?
Because I think exposed API ≠ required API. For example, a library exposes two APIs A.h and B.h which are conflicting. So one don't want to include both in a sketch but the Arduino IDE will add both.

@per1234
Copy link
Contributor

per1234 commented Sep 27, 2020

when this was an intended change

I'm sorry if my comment caused confusion @Legion2. From reading the commit message, I don't at all think this was an intended change. I'm sure it was an unintended change that can be considered a bug.

However, I didn't have any involvement in the project, so I can't say that for certainty. What I can say for certainty is that if this is a bug it will be fixed and if it was an intended change the new behavior will be clearly documented.

Because I think exposed API ≠ required API. For example, a library exposes two APIs A.h and B.h which are conflicting. So one don't want to include both in a sketch but the Arduino IDE will add both.

I think you make a good point. You provided a good example of how this might occur in #934 (comment):

the library "Corsair Lighting Protocol" only declares a single header file which is fine for normal users
(https://github.com/Legion2/CorsairLightingProtocol/blob/82c434f6fb2177faccde82b2e41e5210b009382a/library.properties#L10).
But for other uses cases other headers must be used, which are not declared by the library because they should not be used when a user adds the library in the Arduino IDE to the sketch.

Legion2 added a commit to Legion2/CorsairLightingProtocol that referenced this issue Sep 27, 2020
workaround for arduino/arduino-cli#960
updated platform versions
cmaglie added a commit to cmaglie/arduino-cli that referenced this issue Sep 28, 2020
…y.properties

Otherwise the automatic library discovery would be affected.

Fix arduino#960
cmaglie added a commit to cmaglie/arduino-cli that referenced this issue Sep 28, 2020
…y.properties

Otherwise the automatic library discovery would be affected.

Fix arduino#960
cmaglie added a commit that referenced this issue Sep 29, 2020
* Do not overwrite full headers list with declared 'includes' in library.properties

Otherwise the automatic library discovery would be affected.

Fix #960

* fixed tests for 'provides_includes'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants