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
Can not find c++ include header in cross compiling situation. #157
Comments
Could you also send clangd logs so that we can check what are the exact arguments clangd is using to invoke the compiler? Also please take a look at |
Here is the log, and this issue shouldn't been caused by the |
in |
This patch fixed the issue for me: https://reviews.llvm.org/D73453 |
Before applying the mentioned patch, Below is the relevant part of the log, when clangd is called with As maybe obvious, this is in a yocto system cross compiling for arm.
|
thanks for the logs @topisani I can see what are the outputs of
and
please include both stderr and stdout |
And with the sysroot
So, as can be seen, the driver only outputs the paths for the gcc libs, if not supplied with the sysroot as an argument. |
Solves this issue: clangd/clangd#157 This is my first contribution to an llvm project, so I hope I'm doing it right! Patch by @topisani (Tobias Pisani)! Reviewers: kadircet, klimek Differential Revision: https://reviews.llvm.org/D73811
This patch also fix my issue, thanks. |
Solves this issue: clangd/clangd#157 This is my first contribution to an llvm project, so I hope I'm doing it right! Patch by @topisani (Tobias Pisani)! Reviewers: kadircet, klimek Differential Revision: https://reviews.llvm.org/D73811
Solves this issue: clangd/clangd#157 This is my first contribution to an llvm project, so I hope I'm doing it right! Patch by @topisani (Tobias Pisani)! Reviewers: kadircet, klimek Differential Revision: https://reviews.llvm.org/D73811 (cherry picked from commit 6e8d6bc)
@topisani, did you get your problem resolved? I'm using Yocto and cannot get clangd to find the system headers too. Sorry. I didn't notice that the patch was from you. I guess you solved your problem. I still wonder why my problem persists. Hmm. |
Solves this issue: clangd/clangd#157 This is my first contribution to an llvm project, so I hope I'm doing it right! Patch by @topisani (Tobias Pisani)! Reviewers: kadircet, klimek Differential Revision: https://reviews.llvm.org/D73811 (cherry picked from commit bc48e5f)
I seem to be experiencing this exact issue with clangd built from git. Should I file a new issue or do we track it here? I have this source file: #include <iostream>
int main(int argc, char **argv) {
std::cout << "hello\n";
return 0;
} and this [
{
"directory": "/home/kalle/dev/lsp-clangd-debugging/build-poky",
"command": "/home/kalle/misc/poky-install-x86_64/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/x86_64-poky-linux-g++ --sysroot=/home/kalle/misc/poky-install-x86_64/sysroots/core2-64-poky-linux -o CMakeFiles/hello.dir/hello.cpp.o -c /home/kalle/dev/lsp-clangd-debugging/hello.cpp",
"file": "/home/kalle/dev/lsp-clangd-debugging/hello.cpp"
}
] Then, running
E.g. it does not find Running
By contrast, including the
|
@kalj could you file a new issue please to make sure it doesn't get lost, since this one is closed? (You can always link to this one if they seem related.) |
@HighCommander4 Thanks, done now! |
clangd will use the compiler in the compile_commands.json to find the include path,
On my platform, the compiler is exported as:
This miss the c++ headers, and to locate the c++ headers, the compiler need the sysroot args.
There are already sysroots in the compile_commands.json files, but the clangd dont seem to use it to locate include paths.
So is it possible add the sysroot args to clangd to find all the c++ headers?
The text was updated successfully, but these errors were encountered: