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

Make include detection for old compilers more robust #153

Open
matthijskooijman opened this issue May 18, 2016 · 1 comment
Open

Make include detection for old compilers more robust #153

matthijskooijman opened this issue May 18, 2016 · 1 comment

Comments

@matthijskooijman
Copy link
Collaborator

To figure out what libraries a sketch needs, it is processed by the gcc preprocessor, and its error output is analyzed to figure out what header file is missing. Normally, the compiler outputs an error message followed by the actual source line that has the error, like:

/path/to/foo.ino:1:22: fatal error: somefile.h: No such file or directory
 #include <somefile.h>
                      ^

By matching these lines for #include, the missing filename is found.

However, older compilers do not include this source line, but just the error message:

/path/to/foo.ino:1:22: fatal error: somefile.h: No such file or directory

Currently, there is a fallback that splits on a colon, looks for "fatal error" and then returns the next part of the error message as the filename. This seems to work so far, but is also fairly fragile to changes in the error message.

A better approach might be to instead look at the /path/to/foo.ino:1:22 part (which I expect to be more reliable), load the named file, look up the given line number and see if there is any #include in that line. I believe that would be more reliable, and would make the fallback processing more in-line with the normal processing (by scanning for #include).

@per1234
Copy link
Contributor

per1234 commented Oct 14, 2021

Related: #259

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

2 participants