-
Notifications
You must be signed in to change notification settings - Fork 449
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
Library autodetection doesn't work when one library uses another library #93
Comments
Right now the makefile only auto detects the included libraries from the local source files. This was introduced in commit eef7300 I am not sure if we can easily extend this auto detection to libraries as well. Do you have any suggestion for it? Also as part of issue #45, when we add support for Arduino 1.5.x, we will be implementing Arduino 1.5.x library specification. In this specification the meta file will have the dependency list for libraries. Till then I guess you might have to manually set |
Why not just #include <SPI.h> in your main sketch. That would be the easy fix... or does that fail too? |
Haven't actually tried that, but I expect it to work. Still, it would be better if it would just work right away, but it's not any kind of priority... |
Arduino IDE does not do this either! IIRC you need to place every include you use in the sketch for everything to be located. |
Marking it as But I would be happy to merge it if someone can implement it. |
shouldn't this be closed as its a wontfix ? |
@tinyladi, Nice to know that you are interested in working on this :) One word of caution though. Since this is something that is not supported by Arduino IDE, it would be nice to have this feature turned off by default and enabled only if a flag is set in the makefile. We would like to maintain compatibility with Arduino IDE as much as possible. Having said that, you could look at this c3dc56b I tried doing something similar but left it mid-way. |
For the record, see also arduino/Arduino#236 |
@sudar I'm doing some tests, is it possible to create a test branch in your repo I could PR to so that people could test as well? :) @matthijskooijman can you tell me how you organize your sources? if you have a github repo, it would be even better. |
@ladislas, what are you interested in specifically? I mean I have a sketches folder, containing a libraries folder, containing libraries, but that's pretty standard (and the IDE doesn't allow for a lot of other layouts?) |
@matthijskooijman well you can organize your code as you like if you use the Makefile, for example... But all your libraries are at the same place? something like:
|
I've actually stopped using this Makefile when I switched to 1.5.x, but I stuck to the classic layout before that as well (always good if you can fall back to the IDE). Anyway, I have them like you suggest, yes. |
Thank you very much @sudar :) I'll push in tonight or tomorrow. Right now, auto-detection works. The work around is to use: ARDUINO_LIBS += $(notdir $(wildcard $(USER_LIB_PATH)/*))
# instead of
ARDUINO_LIBS += $(filter $(notdir $(wildcard $(USER_LIB_PATH)/*)), \
$(shell sed -ne "s/^ *\# *include *[<\"]\(.*\)\.h[>\"]/\1/p" $(LOCAL_SRCS))) The problem is that it lists all the libraries, even if they're not used in the current sketch being compiled. But that's just the beginning :) |
i was thinking about this just the other day, and as the IDE and the makefile compile all of the core libs even if they're not used, would it really harm to do the same for user libs - i.e. compile everything and leave it to the linker to not link unused ones? so @ladislas one-liner above is enough of a fix....? |
@sej7278 well yes and no. Yes because it seems to be working fine, on my project at least, and if you say that the IDE does the same, it sounds good. No because the But I'm trying to find a more elegant solution. |
yeah i agree its not elegant (and a bit slow the first time) and the IDE doesn't quite do that - it does for the core but not the user libs. i was thinking of a recursive grep rather than a bunch of sed, but it was a random thought at 3am ;-) |
That won't work - if two libraries define functions by the same name, or the same ISR, the linker will barf when they both are linked at the same time (even if not needed, the linker doesn't look at #include lines). |
Hello, is this issue still unsolved? |
I'm happy to see someone else has forked the project! After you do that, it will detect everything, At least it does in my trunk, which this fork is based on... |
Hi, thanks for your quick reply, I am also happy to be able to use your project. However I'm still struggling with some libraries, but will check out including Arduino.h. The reason may be, that on my Raspi IDE 1.0.5 is instalIed don't know how to update it. |
No need to include Arduino.h, read the source, that's already done. And this isn't a fork of anything from xxxajk, don't feed the troll |
While this isn't a fork of my effort, both have a common root, which IIRC is pre-github days. |
Yup, first version of this we have history of this was 2010 |
I'm using the ShiftOutX library, which uses the SPI library. Arduino-Makefile fails to detect this case, resulting in a SPI.h not found error message.
The text was updated successfully, but these errors were encountered: