Closed bleonars closed 3 years ago
Thanks @bleonars for the report. Do I understand it correctly, the problem is the difference between "good" and "bad" is the trailing /
at the end of /usr/bin/arm-none-eabi-gcc
? That surprises me a lot! :) Can you explain the slash relevance for the correct behavior? (Or can you show me the output of ls -l /usr/bin/arm-none-eabi-gcc
? Or what commands I need to run to re-create your arch dev env?)
Do I understand it correctly, the problem is the difference between "good" and "bad" is the trailing
/
at the end of/usr/bin/arm-none-eabi-gcc
? Can you explain the slash relevance for the correct behavior?
Yes, that is correct. I'm not sure what the relevance of the slash is myself either... However, when I add the slash clangd now detects the standard library and coc.clangd provides me the right suggestions without errors, where it does not if the slash is missing.
(Or can you show me the output of
ls -l /usr/bin/arm-none-eabi-gcc
? Or what commands I need to run to re-create your arch dev env?)
sudo pacman -Sy arm-none-eabi-gcc arm-none-eabi-binutils arm-none-eabi-new
After further testing I've come to the conclusion that the whole arguments' location tag generated by bear for compile_commands.json
is incorrect. Whenever I remove it, or change it to simply /usr/bin/gcc
the issue of the missing stdlib.h disappears. It seems that the issue is with the inability of clangd to find the stdlib.h containing directory when the argument for the compiler location is listed as /usr/bin/arm-none-eabi-gcc
. This makes no sense as the arm-none-eabi-gcc compilation works perfectly fine.
I've done some digging around and found this site https://releases.llvm.org/10.0.0/tools/clang/tools/extra/docs/clangd/Configuration.html#id2. I've followed what it says and replaced the /usr/bin/arm-none-eabi-gcc
argument flag with -query-driver=/usr/bin/arm-none-eabi-gcc
. This now works as intended. Therefore, my question becomes: is there any way to change the bear config to generate a -query-driver argument versus just the default arm-none-eabi-gcc binpath?
Thanks for digging into it! The trailing /
is something that I can't understand, and happy to hear that it is not necessarily a problem we need to solve. :smile:
To add extra flags could be already supported by Bear. You just need to specify those in the configuration file. Look for compilers_to_recognize
section, where you can specify extra arguments for each compiler. (Not sure if this is well tested, but that suppose to work.)
Thanks for the information. This seems to fix it. Issue can be closed.
Issue The bear generated
compile_commands.json
causes coc.clangd in vim to reportwhenever arm-none-eabi-gcc path argument is missing "/" symbol. the project compiles fine with arm-none-eabi-gcc and generates correct outputs. only clangd is having issues with the bear generated compile_commands.json causing my intellisense from coc.clangd to highlight stdlib.h as missing
Reproduce Makefile used:
make clean; bear -- make
Generated compile_commands.json
Expected behavior Whenever the compiler flag contains ending "/" the error disappears and the standard library files are included correctly and there is no error.
"/usr/bin/arm-none-eabi-gcc/"
ex.
Environment: