I have the following project definition:
[env:d1_mini]
platform = espressif8266
board = d1_mini
framework = arduino
(plus a few lib_deps but that does not affect this issue)
I generate the compile_commands.json
using:
pio run -t compiledb
and then I move it to the project root
mv .pio/build/d1_mini/compile_commands.json compile_commands.json
When I run clangd LSP I keep getting the follow 5 errors even though the project builds just fine:
- [drv_unknown_argument_with_suggestion] Line 1: unknown argument '-mlongcalls'; did you mean '-mlong-calls'?
- [redefinition_different_typedef] Line 25: in included file: typedef redefinition with different types ('int' vs 'ssize_t' (aka 'long'))
- [drv_unknown_argument] Line 1: unknown argument: '-mtext-section-literals'
- [drv_unknown_argument_with_suggestion] Line 1: unknown argument '-free'; did you mean '-fsee'?
- [drv_unknown_argument] Line 1: unknown argument: '-fipa-pta'
This example is for the ESP8266WiFi.cpp
, but any file in my project gives the same error if I include the ESP8266WiFi.h
or ESP8266WebServer.h
.
I ran the clangd from neovim, but it behaves the same if I run it directly using:
clangd --compile-commands-dir=. '--query-driver=/home/krikava/.platformio/packages/toolchain-xtensa/bin/xtensa-lx106-elf-g++' --check=/home/krikava/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp
from the project directory, i.e. where I have the compile_commands.json
.
Is there any way to fix it?
Just for reference, this is the compile_commands.json
entry for ESP8266WiFi.cpp
:
{
"command": "/home/krikava/.platformio/packages/toolchain-xtensa/bin/xtensa-lx106-elf-g++ -o .pio/build/d1_mini/lib84b/ESP8266WiFi/ESP8266WiFi.cpp.o -c -fno-rtti -std=gnu++17 -fno-exceptions -Os -mlongcalls -mtext-section-literals -falign-functions=4 -U__STRICT_ANSI__ -D_GNU_SOURCE -ffunction-sections -fdata-sections -Wall -Werror=return-type -free -fipa-pta -DPLATFORMIO=50202 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_WEMOS_D1MINI -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DARDUINO=10805 -DARDUINO_BOARD=\\\"PLATFORMIO_D1_MINI\\\" -DFLASHMODE_DIO -DLWIP_OPEN_SRC -DNONOSDK22x_190703=1 -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DVTABLES_IN_FLASH -DMMU_IRAM_SIZE=0x8000 -DMMU_ICACHE_SIZE=0x8000 -I/home/krikava/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src -I/home/krikava/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include -I/home/krikava/.platformio/packages/framework-arduinoespressif8266/cores/esp8266 -I/home/krikava/.platformio/packages/toolchain-xtensa/include -I/home/krikava/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip2/include -I/home/krikava/.platformio/packages/framework-arduinoespressif8266/variants/d1_mini /home/krikava/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp",
"directory": "/home/krikava/Projects/air-quality-sensor/V3",
"file": "/home/krikava/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp"
},