MaskRay / ccls

C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting
Apache License 2.0
3.72k stars 254 forks source link

invalid errors when cross compiling for esp32 #931

Open crides opened 1 year ago

crides commented 1 year ago

(I tried to create a small project and reproduce but I'm not able to even get the file to index so I'll try to describe what happens in the big project)

So I have a project that cross compiles to esp32. I have a compile_commands.json generated from CMake. When I ccls, it gives weird errors depending on what configuration I try.

I always need to replace all toolchain-specific compilers (/path/to/toolchain/xtensa-esp32-elf-gcc) with normal gcc/g++ commands in compile_commands.json for things to be indexed.

If in my .ccls, I have:

%compile_commands.json
-I/home/haoqing/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/xtensa-esp32-elf/include
-I/home/haoqing/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/xtensa-esp32-elf/include/c++/8.4.0/

then ccls gives errors like:

If I replace the %compile_commands.json with %g++ (I don't know what I should expect that does), then it gives things like:

I don't seem to have a problem with ccls not finding headers, cuz there are no errors on the types, and I can go to the definition of e.g. std::shared_ptr and it's in the right include directory (when I use %compile_commands.json as the first line of .ccls).

Any ideas of what can cause issues?

System information