Hi
I am trying to get clangd to work for a project that is cross compield to various targets. Using GCC and regular Makefiles.
First I tried to generate compile_commands.json with “compiledb” project from github.
It generates the filesok, but clangd gets into trouble mixing up stdlib from clang and gcc it seems.
Then I tried with a compile_flags.txt instead and get it to work decently if omitting all references to the sysroot to the cross compile target.
But then it seems the clangd indexer requires compile_commands.json, right?
So is there any recommended way to handle cross_compiled gcc make projects?
I have tried various combinations of these flags:
-gcc-toolchain=path/to/SDK/…/sysroots/core2-64-xyz-linux/…/gcc/x86_64-xyz-linux/8.2.0
-stdlib=libstdc++
–sysroot=path/to/SDK/…/sysroots/core2-64-xyz-linux
-isysroot=path/to/SDK/…/sysroots/core2-64-xyz-linux
But there is always some problems like std lib headers not found or c++17 features not recognized or differences in stdlib messing it up.
So should it be possible to make a cross compile SDK (gcc) work with clangd?
Perhaps an option for me is to generate compile_commands.json and the filter out all references to the SDK?
Regards,
Daniel