Linter error 'stdlib.h' file not found clang (pp_file_not_found)
Want
I want to know which stdlib.h header files are being used.
Hope
I think more people will want to use clangd for coding from now on, so I'd like to make it easy for even C++ beginners to set up clangd.
Expected
Disable Lint error without change other clangd config. Must to do only I need is change including path config in clangd config.
Actual
In included file: 'stdlib.h' file not found clang (pp_file_not_found) [1, 10]
Tried
Arduino core is installed in Project directory by arduino-cli with arduino-cli.yaml.
So, I hoped I can find out in project directory.
But I tried search with fzf, found many stdlib.h, I was confused.
CLI direct use
cd ./poc_renesas_uno
clangd --check=./main.cpp
I[12:34:04.245] Building preamble...
I[12:34:04.426] Built preamble of size 3127968 for file /home/who/Documents/GitHub/poc_renesas_uno/main.cpp version null in 0.18 seconds
I[12:34:04.426] Indexing headers...
E[12:34:04.569] [pp_file_not_found] Line 1: in included file: 'stdlib.h' file not found
I[12:34:04.569] Building AST...
I[12:34:04.585] Indexing AST...
I[12:34:04.585] Building inlay hints
I[12:34:04.585] Building semantic highlighting
I[12:34:04.585] Testing features at each token (may be slow in large files)
I[12:34:04.588] All checks completed, 1 errors
Full result of clang check
I[12:39:58.174] clangd version 18.1.8
I[12:39:58.174] Features: linux
I[12:39:58.174] PID: 50499
I[12:39:58.174] Working directory: /home/who/Documents/GitHub/poc_renesas_uno
I[12:39:58.174] argv[0]: clangd
I[12:39:58.174] argv[1]: --check=./main.cpp
I[12:39:58.174] argv[2]: --
I[12:39:58.175] Entering check mode (no LSP server)
I[12:39:58.175] Testing on source file /home/who/Documents/GitHub/poc_renesas_uno/main.cpp
I[12:39:58.177] Loading compilation database...
I[12:39:58.181] Loaded compilation database from /home/who/Documents/GitHub/poc_renesas_uno/build/compile_commands.json
I[12:39:58.182] Loaded compilation database from /home/who/Documents/GitHub/poc_renesas_uno/build/compile_commands.json
I[12:39:58.184] Compile command inferred from /home/who/Documents/GitHub/poc_renesas_uno/build/sketch/main.cpp is: [/home/who/Documents/GitHub/poc_renesas_uno] /home/who/Documents/GitHub/poc_renesas_uno/Arduino/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ --target=arm-none-eabi --driver-mode=g++ -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -MMD -nostdlib -DF_CPU=48000000 -DARDUINO_UNOR4_MINIMA -MMD -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -DARDUINO=10607 "-DPROJECT_NAME=\"/home/who/Documents/GitHub/poc_renesas_uno/build/poc_renesas_uno.ino\"" -DARDUINO_MINIMA -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE=700 -mthumb -D_RA_CORE=CM4 -D_RENESAS_RA_ -DCFG_TUSB_MCU=OPT_MCU_RAXXX -I./ -I./Arduino/data/packages/arduino/tools/arm-none-eabi-gcc -I./Arduino/data/packages/arduino/hardware/renesas_uno/1.1.0/variants/MINIMA/includes -I./Arduino/data/packages/arduino/hardware/renesas_uno/1.1.0/libraries/Arduino_CAN/src -I./Arduino/packages/arduino/hardware/renesas_uno/1.1.0/libraries/Arduino_FreeRTOS/src -I./Arduino/data/packages/arduino/hardware/renesas_uno/1.1.0/libraries -I./Arduino/data/packages/arduino/hardware/renesas_uno/1.1.0/cores/arduino/api/tinyusb -I./Arduino/data/packages/arduino/hardware/renesas_uno/1.1.0/cores/arduino/api/deprecated -I./Arduino/data/packages/arduino/hardware/renesas_uno/1.1.0/cores/arduino/api/deprecated-avr-comp -I./Arduino/data/packages/arduino/hardware/renesas_uno/1.1.0/cores/arduino/api -I./Arduino/data/packages/arduino/hardware/renesas_uno/1.1.0/cores/arduino -I./Arduino/user -I./Arduino/data/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include -I/home/who/Documents/GitHub/poc_renesas_uno/Arduino/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/tinyusb -I/home/who/Documents/GitHub/poc_renesas_uno/Arduino/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/api/deprecated -I/home/who/Documents/GitHub/poc_renesas_uno/Arduino/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/api/deprecated-avr-comp -I/home/who/Documents/GitHub/poc_renesas_uno/Arduino/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino -I/home/who/Documents/GitHub/poc_renesas_uno/Arduino/packages/arduino/hardware/renesas_uno/1.2.0/variants/MINIMA -iprefix/home/who/Documents/GitHub/poc_renesas_uno/Arduino/packages/arduino/hardware/renesas_uno/1.2.0 -iwithprefixbefore/variants/MINIMA/includes/ra/fsp/inc -iwithprefixbefore/variants/MINIMA/includes/ra/fsp/inc/api -iwithprefixbefore/variants/MINIMA/includes/ra/fsp/inc/instances -iwithprefixbefore/variants/MINIMA/includes/ra/arm/CMSIS_5/CMSIS/Core/Include -iwithprefixbefore/variants/MINIMA/includes/ra_gen -iwithprefixbefore/variants/MINIMA/includes/ra_cfg/fsp_cfg/bsp -iwithprefixbefore/variants/MINIMA/includes/ra_cfg/fsp_cfg -iwithprefixbefore/variants/MINIMA/includes/ra/fsp/src/r_usb_basic/src/driver/inc -iwithprefixbefore/variants/MINIMA/includes/ra/fsp/src/r_sce/crypto_procedures/src/sce5/plainkey/private/inc -iwithprefixbefore/variants/MINIMA/includes/ra/fsp/src/r_sce/crypto_procedures/src/sce5/plainkey/public/inc -iwithprefixbefore/variants/MINIMA/includes/ra/fsp/src/r_sce/crypto_procedures/src/sce5/plainkey/primitive -iwithprefixbefore/variants/MINIMA/includes/ra/fsp/src/r_sce/common -iwithprefixbefore/variants/MINIMA/includes/ra/fsp/src/r_sce -std=gnu++17 -I./** -I./Arduino/data/packages/arduino/tools/arm-none-eabi-gcc/** -I./Arduino/packages/arduino/hardware/renesas_uno/1.2.0/variants/MINIMA/includes/** -I./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/variants/MINIMA/** -I./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/libraries/Arduino_CAN/src/** -I./Arduino/packages/arduino/hardware/renesas_uno/1.2.0/libraries/Arduino_FreeRTOS/src/** -I./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/libraries/** -I./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/api/tinyusb/** -I./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/api/deprecated/** -I./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/api/deprecated-avr-comp/** -I./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/api/** -I./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/** -I./Arduino/packages/arduino/hardware/renesas_uno/1.2.0/libraries/** -I./Arduino/data/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/** -I./Arduino/** -resource-dir=/usr/lib/clang/18 -- /home/who/Documents/GitHub/poc_renesas_uno/main.cpp
I[12:39:58.185] Parsing command...
I[12:39:58.193] internal (cc1) args are: -cc1 -triple thumbv7em-none-unknown-eabihf -fsyntax-only -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -nostdsysteminc -target-cpu cortex-m4 -target-feature -crc -target-feature -dotprod -target-feature +dsp -target-feature -mve -target-feature -mve.fp -target-feature -ras -target-feature -bf16 -target-feature -sb -target-feature -i8mm -target-feature -lob -target-feature -cdecp0 -target-feature -cdecp1 -target-feature -cdecp2 -target-feature -cdecp3 -target-feature -cdecp4 -target-feature -cdecp5 -target-feature -cdecp6 -target-feature -cdecp7 -target-feature -pacbti -target-feature -hwdiv-arm -target-feature +hwdiv -target-feature -vfp2 -target-feature +vfp2sp -target-feature -vfp3 -target-feature -vfp3d16 -target-feature +vfp3d16sp -target-feature -vfp3sp -target-feature +fp16 -target-feature -vfp4 -target-feature -vfp4d16 -target-feature +vfp4d16sp -target-feature -vfp4sp -target-feature -fp-armv8 -target-feature -fp-armv8d16 -target-feature -fp-armv8d16sp -target-feature -fp-armv8sp -target-feature -fullfp16 -target-feature -fp64 -target-feature -d32 -target-feature -neon -target-feature -fp16fml -target-feature -crypto -target-feature -sha2 -target-feature -aes -target-feature +strict-align -target-abi aapcs -mfloat-abi hard -Wunaligned-access -debug-info-kind=constructor -dwarf-version=5 -debugger-tuning=gdb -fdebug-compilation-dir=/home/who/Documents/GitHub/poc_renesas_uno -ffunction-sections -fdata-sections -fcoverage-compilation-dir=/home/who/Documents/GitHub/poc_renesas_uno -resource-dir /usr/lib/clang/18 -dependency-file main.d -MT main.o -iprefix /home/who/Documents/GitHub/poc_renesas_uno/Arduino/packages/arduino/hardware/renesas_uno/1.2.0 -iwithprefixbefore /variants/MINIMA/includes/ra/fsp/inc -iwithprefixbefore /variants/MINIMA/includes/ra/fsp/inc/api -iwithprefixbefore /variants/MINIMA/includes/ra/fsp/inc/instances -iwithprefixbefore /variants/MINIMA/includes/ra/arm/CMSIS_5/CMSIS/Core/Include -iwithprefixbefore /variants/MINIMA/includes/ra_gen -iwithprefixbefore /variants/MINIMA/includes/ra_cfg/fsp_cfg/bsp -iwithprefixbefore /variants/MINIMA/includes/ra_cfg/fsp_cfg -iwithprefixbefore /variants/MINIMA/includes/ra/fsp/src/r_usb_basic/src/driver/inc -iwithprefixbefore /variants/MINIMA/includes/ra/fsp/src/r_sce/crypto_procedures/src/sce5/plainkey/private/inc -iwithprefixbefore /variants/MINIMA/includes/ra/fsp/src/r_sce/crypto_procedures/src/sce5/plainkey/public/inc -iwithprefixbefore /variants/MINIMA/includes/ra/fsp/src/r_sce/crypto_procedures/src/sce5/plainkey/primitive -iwithprefixbefore /variants/MINIMA/includes/ra/fsp/src/r_sce/common -iwithprefixbefore /variants/MINIMA/includes/ra/fsp/src/r_sce -D F_CPU=48000000 -D ARDUINO_UNOR4_MINIMA -D ARDUINO=10607 -D "PROJECT_NAME=\"/home/who/Documents/GitHub/poc_renesas_uno/build/poc_renesas_uno.ino\"" -D ARDUINO_MINIMA -D ARDUINO_ARCH_RENESAS_UNO -D ARDUINO_ARCH_RENESAS -D ARDUINO_FSP -D _XOPEN_SOURCE=700 -D _RA_CORE=CM4 -D _RENESAS_RA_ -D CFG_TUSB_MCU=OPT_MCU_RAXXX -I ./ -I ./Arduino/data/packages/arduino/tools/arm-none-eabi-gcc -I ./Arduino/data/packages/arduino/hardware/renesas_uno/1.1.0/variants/MINIMA/includes -I ./Arduino/data/packages/arduino/hardware/renesas_uno/1.1.0/libraries/Arduino_CAN/src -I ./Arduino/packages/arduino/hardware/renesas_uno/1.1.0/libraries/Arduino_FreeRTOS/src -I ./Arduino/data/packages/arduino/hardware/renesas_uno/1.1.0/libraries -I ./Arduino/data/packages/arduino/hardware/renesas_uno/1.1.0/cores/arduino/api/tinyusb -I ./Arduino/data/packages/arduino/hardware/renesas_uno/1.1.0/cores/arduino/api/deprecated -I ./Arduino/data/packages/arduino/hardware/renesas_uno/1.1.0/cores/arduino/api/deprecated-avr-comp -I ./Arduino/data/packages/arduino/hardware/renesas_uno/1.1.0/cores/arduino/api -I ./Arduino/data/packages/arduino/hardware/renesas_uno/1.1.0/cores/arduino -I ./Arduino/user -I ./Arduino/data/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include -I /home/who/Documents/GitHub/poc_renesas_uno/Arduino/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/tinyusb -I /home/who/Documents/GitHub/poc_renesas_uno/Arduino/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/api/deprecated -I /home/who/Documents/GitHub/poc_renesas_uno/Arduino/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/api/deprecated-avr-comp -I /home/who/Documents/GitHub/poc_renesas_uno/Arduino/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino -I /home/who/Documents/GitHub/poc_renesas_uno/Arduino/packages/arduino/hardware/renesas_uno/1.2.0/variants/MINIMA -I ./** -I ./Arduino/data/packages/arduino/tools/arm-none-eabi-gcc/** -I ./Arduino/packages/arduino/hardware/renesas_uno/1.2.0/variants/MINIMA/includes/** -I ./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/variants/MINIMA/** -I ./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/libraries/Arduino_CAN/src/** -I ./Arduino/packages/arduino/hardware/renesas_uno/1.2.0/libraries/Arduino_FreeRTOS/src/** -I ./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/libraries/** -I ./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/api/tinyusb/** -I ./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/api/deprecated/** -I ./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/api/deprecated-avr-comp/** -I ./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/api/** -I ./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/** -I ./Arduino/packages/arduino/hardware/renesas_uno/1.2.0/libraries/** -I ./Arduino/data/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/** -I ./Arduino/** -internal-isystem /home/who/Documents/GitHub/poc_renesas_uno/Arduino/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/../lib/clang-runtimes/arm-none-eabi/include/c++/v1 -internal-isystem /usr/lib/clang/18/include -internal-isystem /home/who/Documents/GitHub/poc_renesas_uno/Arduino/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/../lib/clang-runtimes/arm-none-eabi/include -Os -w -std=gnu++17 -fdeprecated-macro -ferror-limit 19 -fno-builtin -fno-rtti -fno-use-cxa-atexit -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -vectorize-loops -vectorize-slp -no-round-trip-args -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -x c++ /home/who/Documents/GitHub/poc_renesas_uno/main.cpp
I[12:39:58.195] Building preamble...
I[12:39:58.361] Built preamble of size 3127968 for file /home/who/Documents/GitHub/poc_renesas_uno/main.cpp version null in 0.17 seconds
I[12:39:58.362] Indexing headers...
E[12:39:58.493] [pp_file_not_found] Line 1: in included file: 'stdlib.h' file not found
I[12:39:58.493] Building AST...
I[12:39:58.506] Indexing AST...
I[12:39:58.506] Building inlay hints
I[12:39:58.506] Building semantic highlighting
I[12:39:58.506] Testing features at each token (may be slow in large files)
I[12:39:58.509] All checks completed, 1 errors
PoC (Steps to reproduce)
https://github.com/ShortArrow/poc_renesas_uno
git clone https://github.com/ShortArrow/poc_renesas_uno
cd poc_renesas_uno
./tools/install_libs.sh
code --install-extension llvm-vs-code-extensions.vscode-clangd
code ./
Most Important Setting
CompileFlags:
Add: [
"-I./**",
"-I./Arduino/data/packages/arduino/tools/arm-none-eabi-gcc/**",
"-I./Arduino/packages/arduino/hardware/renesas_uno/1.2.0/variants/MINIMA/includes/**",
"-I./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/variants/MINIMA/**",
"-I./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/libraries/Arduino_CAN/src/**",
"-I./Arduino/packages/arduino/hardware/renesas_uno/1.2.0/libraries/Arduino_FreeRTOS/src/**",
"-I./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/libraries/**",
"-I./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/api/tinyusb/**",
"-I./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/api/deprecated/**",
"-I./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/api/deprecated-avr-comp/**",
"-I./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/api/**",
"-I./Arduino/data/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/**",
"-I./Arduino/packages/arduino/hardware/renesas_uno/1.2.0/libraries/**",
"-I./Arduino/data/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/**",
"-I./Arduino/**",
]
Env
- arduino:renesas_uno:minima
- arduino-cli Version: 0.35.3-arch Commit: 95cfd654fe0dd6b07e903d3132c0faceabfbe9e
- https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd
Thanks
I hope that the Arduino community is welcoming and accommodating to beginners. I understand that responding to requests like this issue can be cumbersome and anoying and sometimes distracts from the main focus.
I will not forget to express my gratitude to everyone who has taken the time to read this.
This issue is now two months old, but it's more likely an issue with your environment than an issue with Arduino.
@rowingdude Yes, I think too. I has same guess it's an issue specific to the repository I created.
Updated first message of this Issue.
Fixed by https://github.com/ShortArrow/poc_renesas_uno/commit/3a06f1cc9c83e6fc6094930dd09d33313d7bad6b
I tried download a source file https://github.com/Patapom/Arduino/blob/master/Libraries/AVR%20Libc/avr-libc-2.0.0/include/stdlib.h and add it to the clangd dir