quotes in --sysroot breaks clangd
Logiase opened this issue · comments
Describe the bug
set --sysroot
in utilities.cmake
breaks clangd.
Sources to reproduce
any exmaple.
Steps to reproduce
- Copy and build an example
- take a look at
compile_commands.json
, and you will see--sysroot=\\\"/usr/arm-none-eabi\\\"
- run
clangd --check={any source}
, and there's an error means clangd cant find system headers, and checkinterlnal (cc1) args
in output, the redundant quotes and slash breaks the path.
Expected behavior
clangd is a very common lsp server, it should works fine
Screenshots
see
-isysroot "\"/usr/arm-none-eabi\""
and-internal-isystem "\"/usr/arm-nonea-eabi\"/include"
redundant quotes and slashs in compile_commands.json
:
Environment (please complete the following information):
-
OS: ArchLinux
-
Compiler: arm-none-eabi-gcc 12.2.0
-
stm32-cmake: abea019 (newest)
-
cmake: 3.25.1
-
HAL/cube/CMSIS: stm32cubeh7 v1.11.0
Additional context
This problem has no effected on compilation, but it cause most IDE or editors which use clangd as LSP server does not work.
For example, math.h
not found.
Remove quotes in utilities.cmake
can solve this problem, but it also affects spaces in sysroot path.
while the stm32cube hal library has no space protection
I think it should be mentioned somewhere and tell users how to make clangd
work, or just remove the quotes.
Hello,
Thanks for this detailed issue. I can confirm this is an issue right now, but the solution is actually already on PR #290.
I will try to merge this PR and solve your issue :)
Cya
Hi
PR #290 can fix this issue, and correctly handles the spaces in sysroot path without redundant slash.
closing as fixed in #290