Open coyorkdow opened 2 weeks ago
However, when I checked the clangd's log,
/usr/lib/gcc/x86_64-linux-gnu/6/include
is missing.I[16:52:40.824] System includes extractor: successfully executed /usr/bin/g++ got includes: "/usr/include/c++/6, /usr/include/x86_64-linux-gnu/c++/6, /usr/include/c++/6/backward, /usr/local/include, /usr/lib/gcc/x86_64-linux-gnu/6/include-fixed, /usr/include/x86_64-linux-gnu, /usr/include" got target: "x86_64-linux-gnu"
It can be solved by adding an additional
.clangd
file in the project source path. LikeCompileFlags: Add: - "-I/usr/lib/gcc/x86_64-linux-gnu/6/include"
But apparently I want to know why clangd cannot find this system path.
I believe this is caused by the change made in https://github.com/clangd/clangd/issues/1695. You can have a look at the issue and/or this code for the motivation.
Your workaround of adding back the external compiler's built-in include path in a case like this is probably the best approach.
For some reason, the "--compile-commands-dir" parameter now makes the "--query-driver" parameter invalid. You can't use these two parameters at the same time
For some reason, the "--compile-commands-dir" parameter now makes the "--query-driver" parameter invalid. You can't use these two parameters at the same time
Using those two parameters together should work fine. If it's not working as expected, please share logs in a new issue.
Please describe the problem
I found tones of errors produced by clangd today, in a project that has been developed for months. Clangd worked well with this project but suddenly everything turned wrong. So I delve into this issue and found the root problem is an error when resolving a dependency's header.
It hinted
In included file: 'sanitizer/asan_interface.h' file not foundclang(pp_file_not_found)
. This is a header from asan. I enabled asan for debugging, and my project can be compiled on this host with asan opened. I also confirmed thatsanitizer/asan_interface.h
exists on the host, it is located at/usr/lib/gcc/x86_64-linux-gnu/6/include
.My compiler is
/usr/bin/g++
, which is exactly the executable that be specified incompile_commands.json
. And I also specified the--query-driver=/usr/bin/g++
. According to the examining of gcc, I am pretty sure that such directory can be lookup by my compiler.However, when I checked the clangd's log,
/usr/lib/gcc/x86_64-linux-gnu/6/include
is missing.It can be solved by adding an additional
.clangd
file in the project source path. LikeBut apparently I want to know why clangd cannot find this system path.
Logs
System information
clangd version (from the log, or
clangd --version
):clangd version 18.1.3 (https://github.com/llvm/llvm-project c13b7485b87909fcf739f62cfa382b55407433c0) Features: linux+grpc Platform: x86_64-unknown-linux-gnu
clangd extension version
v0.1.28
Operating system
PRETTY_NAME="Debian GNU/Linux 10 (buster)" NAME="Debian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"