-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
compileCommands do not work when ccache is used #7616
Comments
Hmm, I don't see it working with 1.3.1 either -- I see it fail to query /usr/bin/ccache because the /usr/bin/gcc argument is removed. What version worked for you? UPDATE: I see it work for 1.0.1 (we changed our behavior to strip unexpected arguments in some version in between). You may be able to workaround the issue via setting compilerPath to "/usr/bin/gcc" and compilerArgs to "["-c", "-m64", "-std=c++17", "-I", "~/.xmake/packages/g/glm/0.9.9+8/65b1ad153bda4a43b0454eba7969327f/include"]. |
I think the issue here is that we're expecting a command line to a gcc-like compiler. The path to gcc is getting stripped out because any args that appear to refer to files (i.e. to compile) need to be removed when we probe a compiler for system includes and system defines. . We will need to find a way to handle this scenario, possibly with specific handling for ccache. |
I have been working with this extension for a long time now and up until now I never had any issues. Before automatically updating to 1.4.0 I was working with 1.3.0 and this was working fine for me. |
Yes, this seems to fix the issue |
This is still an issue, any update? I think it should be as easy as:
Note that using |
It confuses vscode's intellisense, causing it to not understand GNUC syntaxes for example. The bug was reported upstream with not much activity: microsoft/vscode-cpptools#7616.
It confuses vscode's intellisense, causing it to not understand GNUC syntaxes for example. The bug was reported upstream: microsoft/vscode-cpptools#7616
It confuses vscode's intellisense, causing it to not understand GNUC syntaxes for example. The bug was reported upstream: microsoft/vscode-cpptools#7616
It confuses vscode's intellisense, causing it to not understand GNUC syntaxes for example. The bug was reported upstream: microsoft/vscode-cpptools#7616
It confuses vscode's intellisense, causing it to not understand GNUC syntaxes for example. The bug was reported upstream: microsoft/vscode-cpptools#7616 Write the patched file into vscode_compile_commands.json to not modify a file that could be used by other programs. Make sure C/C++ extension uses the file we create.
It confuses vscode's intellisense, causing it to not understand GNUC syntaxes for example. The bug was reported upstream: microsoft/vscode-cpptools#7616 Write the patched file into vscode_compile_commands.json to not modify a file that could be used by other programs. Make sure C/C++ extension uses the file we create.
@sean-mcmanus Out of curiousity, the fix is in the extension, or vscode itself? Because I did not switch the cpptools extension to pre-release but I can't reproduce the problem with ccache anymore. In any case, thanks a lot! |
The fix should only be in the 1.15.2 (pre-release) of our C/C++ extension and not with VS Code itself (i.e. with 1.14.5 of the C/C++ extension). |
@sean-mcmanus Nice to see this getting fixed. I did a small test just now and unfortunately the fix in 1.15.2 only works for |
That's why my snippet above suggested |
The sccache case is fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.15.3 . |
Bug type: Language Service
Describe the bug
Im am working on a C++17 project using xmake. This build system creates a compile_commands.json. If it detects ccache on the system it will use it instead of just gcc. This is also written into the compile_commands.json file. In previous versions the extension could retrieve all necessary information, but since 1.4.0 it can't and almost all types are not detected including the standard library.
Steps to reproduce
xmake project -k compile_commands
Expected behavior
All types should be detected as normal. I tried out removing all ccache entries of compile_commands.json, to see if it would work. And as I expected removing it made it work.
Code sample and logs
Code sample
Configurations in
c_cpp_properties.json
Logs from running
C/C++: Log Diagnostics
from the VS Code command paletteLogs from the language server logging
Screenshots
Additional context
The text was updated successfully, but these errors were encountered: