dev.ed.am
Arduino Makefile
Go to the previous open issue
Go to the previous issue (open or closed)
star_faded.png
Please log in to bookmark issues
icon_project.png Arduino Makefile / Closed Bug report #3 Library directory selection is too strict
action_vote_minus_faded.png
0
Votes
action_vote_plus_faded.png
Go to the next issue (open or closed)
Go to the next open issue
This issue has been closed with status "Closed" and resolution "RESOLVED".
Issue basics
  • Type of issue
    Bug report
  • Targetted for
    Not determined
  • Status
    Closed
  • Progress
  • Priority
    Not determined
User pain
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
Affected by this issue (1)
People involved
Times and dates
  • Posted at
  • Last updated
Issue details
  • Resolution
    RESOLVED
  • Reproducability
    Always
  • Severity
    Normal
Attachments (0)
There is nothing attached to this issue
Duplicate issues (0)
This issue does not have any duplicates
Description
The arduino IDE automatically includes a library in the build (i.e. builds it and links against it) if *any* header in the root of a library's directory is #included. So, for example, you can have a library directory called foo which contains bar.h and going
<source lang="c++">#include <bar.h></source>
would automatically include the foo library in the build.

The makefile's logic is slightly different. It only automatically includes libraries only if the included header has the same name as the library directory. So in the above example, the foo library would not be included. This logic needs to be made more compatible.

The IDE's logic is horrible. For example, adding a math.h to a library makes the system math.h inaccessible. And two libraries (which might have been written by unrelated 3rd parties, remember) can not have headers with the same name and both be accessible. But fortunately, the makefile's automatic inclusion of libraries is only done in the "automatic" mode, so the IDE's crappy logic can be overridden and libraries specified manually.
Steps to reproduce this issue
# use the makefile in automatic mode.
# #inlucde a header from a library where the header name is different from the library name
# observe the makefile not including the library in the build.
Todos (0 / 0)
Issue created



To auto-link to an existing issue, write "issue", "bug", "ticket" or the issue type (like "bug report" or "enhancement") followed by the issue number (ex: "ticket #3" or "bug report MYPROJ-1"). Enclose sourcecode samples between two "~~~~" lines.
See more formatting tips in MarkdownFormatting.

To specify bold text put text between two stars, and for underlines put text between two underscores.
See more formatting tips in MarkdownFormatting.

If you want to put a horizontal line in the document, use four dashes: "----".
See more formatting tips in WikiFormatting.

Cancel
arduino-mk_0.4.txz is now affected by this issue



To auto-link to an existing issue, write "issue", "bug", "ticket" or the issue type (like "bug report" or "enhancement") followed by the issue number (ex: "ticket #3" or "bug report MYPROJ-1"). Enclose sourcecode samples between two "~~~~" lines.
See more formatting tips in MarkdownFormatting.

To create a bulleted list, start one or more lines with a star ("* bulleted list item"). You can create a numbered list by using the hash/pund sign instead ("# numbered list item").
See more formatting tips in MarkdownFormatting.

If you have certain text you don't want to be formatted, enclose it in <nowiki></nowiki> tags: "'''formatted''' text <nowiki>'''non-formatted''' text</nowiki>.
See more formatting tips in WikiFormatting.

Cancel
The issue was updated with the following change(s):
  • The severity has been updated, from Not determined to Critical.
  • The milestone has been updated, from Not determined to 0.6 release.



Don't worry about URLs - they will automatically be transformed to links.
See more formatting tips in MarkdownFormatting.

To auto-link to an existing issue, write "issue", "bug", "ticket" or the issue type (like "bug report" or "enhancement") followed by the issue number (ex: "ticket #3" or "bug report MYPROJ-1"). Enclose sourcecode samples between two "~~~~" lines.
See more formatting tips in MarkdownFormatting.

Code samples are best presented in <source></source> tags. The Bug Genie can automatically apply syntax highlighting with support for over 100 languages! (<source lang="php"><?php echo "fu"; ?></source>)
See more formatting tips in WikiFormatting.

Cancel
The issue was updated with the following change(s):
  • The status has been updated, from New to Confirmed.



Don't worry about URLs - they will automatically be transformed to links.
See more formatting tips in MarkdownFormatting.

To create a bulleted list, start one or more lines with a star ("* bulleted list item"). You can create a numbered list by using the hash/pund sign instead ("# numbered list item").
See more formatting tips in MarkdownFormatting.

To create a bulleted list, start one or more lines with a star ("* bulleted list item"). You can create a numbered list by using the hash/pund sign instead ("# numbered list item").
See more formatting tips in WikiFormatting.

Cancel
The issue was updated with the following change(s):
  • The status has been updated, from Confirmed to Being worked on.
  • Information about the user working on this issue has been changed, from Not being worked on to edam.



Don't worry about URLs - they will automatically be transformed to links.
See more formatting tips in MarkdownFormatting.

To create a bulleted list, start one or more lines with a star ("* bulleted list item"). You can create a numbered list by using the hash/pund sign instead ("# numbered list item").
See more formatting tips in MarkdownFormatting.

The Bug Genie will automatically add new lines when you add two new lines in your text, whereas one new line is used for formatting as you type. To force a new line, use the <br> tag: "There is a new<br>line here".
See more formatting tips in WikiFormatting.

Cancel
The issue was updated with the following change(s):
  • The owner has been changed to edam.



To auto-link to an existing issue, write "issue", "bug", "ticket" or the issue type (like "bug report" or "enhancement") followed by the issue number (ex: "ticket #3" or "bug report MYPROJ-1"). Enclose sourcecode samples between two "~~~~" lines.
See more formatting tips in MarkdownFormatting.

To specify bold text put text between two stars, and for underlines put text between two underscores.
See more formatting tips in MarkdownFormatting.

The Bug Genie will automatically add new lines when you add two new lines in your text, whereas one new line is used for formatting as you type. To force a new line, use the <br> tag: "There is a new<br>line here".
See more formatting tips in WikiFormatting.

Cancel
The issue was updated with the following change(s):
  • The status has been updated, from Being worked on to Investigating.
  • The milestone has been updated, from 0.6 release to Not determined.
  • The severity has been updated, from Critical to Normal.



To auto-link to an existing issue, write "issue", "bug", "ticket" or the issue type (like "bug report" or "enhancement") followed by the issue number (ex: "ticket #3" or "bug report MYPROJ-1"). Enclose sourcecode samples between two "~~~~" lines.
See more formatting tips in MarkdownFormatting.

To specify bold text put text between two stars, and for underlines put text between two underscores.
See more formatting tips in MarkdownFormatting.

To create a bulleted list, start one or more lines with a star ("* bulleted list item"). You can create a numbered list by using the hash/pund sign instead ("# numbered list item").
See more formatting tips in WikiFormatting.

Cancel
Having read through the IDE code, it seems that the behaviour of the IDE, which we're talking about mimicking here, is as follows:
  1. obtain a list of all library directory names (i.e. the names of directories in the library directory, e.g., "Wire", "GSM", etc.)
  2. sort these alphabetically
  3. for each library directory in turn, obtain all top-level header files
  4. for each header file in turn, add a mapping for the header file with its path stripped to the library directory it came from, overwriting any previous mapping for a header file with the same name
  5. do the above with the main libraries folder, and then again with the sketch's libraries folder
  6. use the mappings to try to pull in a library directory whenever a header is #included in the main sketch
So the up-shot of that process is that, for any header file, the greatest named (alphabetically speaking) library containing a header of that name will be used. And sketch libraries override main libraries. So this would explain why #including Wire.h pulls in the Wire library, and not the Robot_Control library, which also contains a Wire.h.

This behaviour is quite obviously extremely fragile and seems rather ill conceived. I can imagine a variety of situations where it might lead to problematic behaviour. For example...
  • adding a header to your library can prevent other libraries from loading (e.g., a Wire.h in your new "Zebra" library will prevent the Wire library from working)
  • using two third-party libraries in the same sketch that happen to both contain some header with the same name will result in only one working (so are all third-party library developers are expected to co-ordinate the names of their headers so as not to have any naming clashes?)
  • using a third-party library that happens to contain a header with the same name as any header in any of the main libraries will probably prevent the main library from working (so are all third-party library developers expected to test their library in combination with every main library?)
  • the Robot_Control library can not (apparently) be used at the same time as the Wire library, as they both contain a header with the same name, despite them both being regular libraries shipped with the Arduino 1.0.5 software
The single reason to implement this behaviour would be for compatibility with the IDE. But, for the reasons above, my instincts are strongly against implementing it. So I am quite interested to discover some examples of situations where not mimicking this behaviour leads to a problem and also, then, in trying to figure out how common/widespread such problems might be. I have no desire to cause incompatibility, but if the degree to which not implementing this will cause problems is relatively insignificant, there might be case to justify it.




Don't worry about URLs - they will automatically be transformed to links.
See more formatting tips in MarkdownFormatting.

Code samples are best presented between two "~~~~"-lines. The Bug Genie can automatically apply syntax highlighting with support for over 100 languages! (<source lang="php"><?php echo "fu"; ?></source>)
See more formatting tips in MarkdownFormatting.

URLs will be automatically transformed to links. If you want to add a title, use the link formatter: [[http://awesome.com/something An awesome link]].
See more formatting tips in WikiFormatting.

Cancel
I've thought of a simple solution...

I'm going to implement the horrible behaviour of the IDE (since the makefile *is* supposed to be a drop-in replacement for it, afterall). But, if set, I'll make the LIBRARIES variable override the automatic library selection. That way, even in automatic mode, a developer can specify which libraries they want if they need to.



To auto-link to an existing issue, write "issue", "bug", "ticket" or the issue type (like "bug report" or "enhancement") followed by the issue number (ex: "ticket #3" or "bug report MYPROJ-1"). Enclose sourcecode samples between two "~~~~" lines.
See more formatting tips in MarkdownFormatting.

Code samples are best presented between two "~~~~"-lines. The Bug Genie can automatically apply syntax highlighting with support for over 100 languages! (<source lang="php"><?php echo "fu"; ?></source>)
See more formatting tips in MarkdownFormatting.

You can use simple formatting tags for underlined text (<b></b>) or strikethrough (<strike></strike>).
See more formatting tips in WikiFormatting.

Cancel
The issue was updated with the following change(s):
  • The status has been updated, from Investigating to Being worked on.



Don't worry about URLs - they will automatically be transformed to links.
See more formatting tips in MarkdownFormatting.

To auto-link to an existing issue, write "issue", "bug", "ticket" or the issue type (like "bug report" or "enhancement") followed by the issue number (ex: "ticket #3" or "bug report MYPROJ-1"). Enclose sourcecode samples between two "~~~~" lines.
See more formatting tips in MarkdownFormatting.

You can use simple formatting tags for underlined text (<b></b>) or strikethrough (<strike></strike>).
See more formatting tips in WikiFormatting.

Cancel
The issue was updated with the following change(s):
  • The status has been updated, from Being worked on to Confirmed.
  • This issue's progression has been updated to 10 percent completed.



Don't worry about URLs - they will automatically be transformed to links.
See more formatting tips in MarkdownFormatting.

The Bug Genie uses an enhanced flavor of the markdown syntax, which makes each newline count. If you want to add a linebreak, add a new line and it will be presented just like you type.
See more formatting tips in MarkdownFormatting.

If you want to add text that is not supposed to be parsed, put it inside <nowiki> tags, or start the line with a space.
See more formatting tips in WikiFormatting.

Cancel
fixed in r89

The issue was updated with the following change(s):
  • This issue has been closed
  • The status has been updated, from Confirmed to Closed.
  • This issue's progression has been updated to 100 percent completed.
  • The resolution has been updated, from Not determined to RESOLVED.
  • Information about the user working on this issue has been changed, from edam to Not being worked on.
footer_logo.png The Bug Genie 4.3.1 | Support | Feedback spinning_16.gif