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

[bug-maybe] Clangd Plugin Fails to Resolve Header Files in .conan2 Directory Despite Correct compile_commands.json #762

Open
marco-hmc opened this issue Dec 24, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@marco-hmc
Copy link

marco-hmc commented Dec 24, 2024

In an offline development environment, when working on a large project with nearly a million lines of code using VS Code and the Clangd plugin, the following issue occurs:

When attempting to navigate to header files located under the .conan2 directory, these files display a "file not found" error. Although the generated compile_commands.json file is correct, the Clangd plugin seems unable to properly parse and locate these header files.


Issue Description:

When working on a large project, the log output differs between the offline and online machines.

Offline Machine Log:

I[09:34:39.436] Failed to find compilation database for /home/marco/.conan2/p/xxxp/include/xxx.h
I[09:34:39.437] ASTWorker building file /home/marco/.conan2/p/xxx/include/gtest/internal/xxx.h version 1 with command clangd fallback

Online Machine Log:

I[09:34:39.436] Failed to find compilation database for /home/marco/.conan2/p/xxxp/include/xxx.h
I[09:34:39.437] ASTWorker building file /home/marco/.conan2/p/xxx/include/gtest/internal/xxx.h version 1 with command inferred from /home/marco/xxx.cpp

The key difference lies in how the commands are determined:

  • Offline Machine: Clangd falls back to a default configuration as it cannot infer the command from any specific source file.
  • Online Machine: Clangd successfully infers the command based on /home/marco/xxx.cpp, allowing it to parse and process the headers correctly.

Attempts to specify header file paths in settings.json were also unsuccessful on the offline machine.

This indicates that the offline machine is unable to resolve header file paths properly due to the lack of a valid compilation database or other essential project information. In contrast, the online machine can infer the necessary details and process the project as expected.

@marco-hmc marco-hmc added the bug Something isn't working label Dec 24, 2024
@HighCommander4
Copy link
Contributor

What is the difference between the "offline machine" and the "online machine"?

Can you share complete logs, from clangd startup until encountering an unexpected diagnostic?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants