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

Relative include flags with spaces cause parsing failure #571

Open
andocz opened this issue Mar 22, 2022 · 3 comments · May be fixed by #572
Open

Relative include flags with spaces cause parsing failure #571

andocz opened this issue Mar 22, 2022 · 3 comments · May be fixed by #572

Comments

@andocz
Copy link
Contributor

andocz commented Mar 22, 2022

When parsing Scintilla 3.10.6, errors like this occur:

/mnt/linux/hg/scintilla-code/lexlib/Accessor.cxx:11:10: fatal error: 'ILexer.h' file not found
#include "ILexer.h"

This is because Scintilla uses spaces in the include flags, like so (in gtk/makefile):

INCLUDEDIRS=-I $(srcdir)/../include -I $(srcdir)/../src -I $(srcdir)/../lexlib

This causes an issue due to the combination of the following two things:

  1. CodeCompass_logger doesn't convert include flags with spaces to absolute paths.
  2. CodeCompass_parser can only handle absolute include paths.

Removing the space after every -I in gtk/makefile fixed the issue, confirming this explanation.

@mcserep mcserep added this to the Release Gershwin milestone Mar 23, 2022
@mcserep mcserep added Kind: Bug ⚠️ Kind: Important 🥇 Target: Logger Issues related to the custom logger. labels Mar 23, 2022
@mcserep
Copy link
Collaborator

mcserep commented Mar 23, 2022

Does CodeChecker's logger handle this correctly? If so, can we update CodeCompass' logger with the one in CodeChecker?

@andocz
Copy link
Contributor Author

andocz commented Mar 24, 2022

CodeChecker's logger keeps the include paths as-is, it never converts a relative path to an absolute one or vice-versa.

I think the proper fix would be to make the C++ parser use the compile command's recorded directory as the working directory when running ClangTool. We shouldn't rely on compile_commands.json to only contain absolute paths. Even if CodeCompass_logger always successfully converted all paths to absolute, other tools may generate compilation databases with relative paths (see CodeChecker).

@andocz andocz linked a pull request Mar 28, 2022 that will close this issue
@mcserep mcserep linked a pull request Mar 28, 2022 that will close this issue
@whisperity
Copy link
Collaborator

I think the proper fix would be to make the C++ parser use the compile command's recorded directory as the working directory when running ClangTool.

This does seem like the right call, but let's ask @bruntib to give us a heads-up related to this issue and what steps were taken in CodeChecker. I have vague memories of issues like this constantly looming around us...

@mcserep mcserep modified the milestones: Release Gershwin, Release H* Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To do
Development

Successfully merging a pull request may close this issue.

4 participants