-
-
Notifications
You must be signed in to change notification settings - Fork 839
Description
Configuration
Operating system: Linux (Arch, 5.14.14)
PlatformIO Version: 5.2.2
Description of problem
(I first asked in the forum where it was suggested I open an issue here.)
I have the following project definition (platform.ini):
[env:d1_mini]
platform = espressif8266
board = d1_mini
framework = arduinoI 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 source file in my project gives the same errors. There will be at least the unknown arguments and the typedef redefinition will be seen if I include the ESP8266WiFi.h or ESP8266WebServer.h.
I'm running 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.
The drv_unknown_argument* errors are easy to fix via using .clangd config like:
CompileFlags:
Remove: [-mlongcalls, -free, -mtext-section-literals, -fipa-pta]
But how can I fix the typedef redefinion?
Additional info
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"
},