Unable to compile STM32 project.
Trying to compile the code generated by cubeMX, whitout modification, but the compiler can't find the headers “errno.h” and “sys/stat.h”.
I get this error message.
====================[ Build | senses.elf | Debug ]==============================
/home/anthony/.local/share/JetBrains/Toolbox/apps/clion/bin/cmake/linux/x64/bin/cmake --build /home/anthony/Repositories/senses/cmake-build-debug --target senses.elf -j 3
[1/3] Building C object CMakeFiles/senses.elf.dir/Src/sysmem.c.obj
FAILED: CMakeFiles/senses.elf.dir/Src/sysmem.c.obj
/usr/bin/arm-none-eabi-gcc -DDEBUG -DSTM32F030x6 -DUSE_HAL_DRIVER -I/home/anthony/Repositories/senses/Inc -I/home/anthony/Repositories/senses/Drivers/STM32F0xx_HAL_Driver/Inc -I/home/anthony/Repositories/senses/Drivers/STM32F0xx_HAL_Driver/Inc/Legacy -I/home/anthony/Repositories/senses/Drivers/CMSIS/Device/ST/STM32F0xx/Include -I/home/anthony/Repositories/senses/Drivers/CMSIS/Include -g -std=gnu11 -fdiagnostics-color=always -mcpu=cortex-m0 -mthumb -mthumb-interwork -ffunction-sections -fdata-sections -fno-common -fmessage-length=0 -Og -g -MD -MT CMakeFiles/senses.elf.dir/Src/sysmem.c.obj -MF CMakeFiles/senses.elf.dir/Src/sysmem.c.obj.d -o CMakeFiles/senses.elf.dir/Src/sysmem.c.obj -c /home/anthony/Repositories/senses/Src/sysmem.c
/home/anthony/Repositories/senses/Src/sysmem.c:24:10: fatal error: errno.h: No such file or directory
24 | #include <errno.h>
| ^~~~~~~~~
compilation terminated.
[2/3] Building C object CMakeFiles/senses.elf.dir/Src/syscalls.c.obj
FAILED: CMakeFiles/senses.elf.dir/Src/syscalls.c.obj
/usr/bin/arm-none-eabi-gcc -DDEBUG -DSTM32F030x6 -DUSE_HAL_DRIVER -I/home/anthony/Repositories/senses/Inc -I/home/anthony/Repositories/senses/Drivers/STM32F0xx_HAL_Driver/Inc -I/home/anthony/Repositories/senses/Drivers/STM32F0xx_HAL_Driver/Inc/Legacy -I/home/anthony/Repositories/senses/Drivers/CMSIS/Device/ST/STM32F0xx/Include -I/home/anthony/Repositories/senses/Drivers/CMSIS/Include -g -std=gnu11 -fdiagnostics-color=always -mcpu=cortex-m0 -mthumb -mthumb-interwork -ffunction-sections -fdata-sections -fno-common -fmessage-length=0 -Og -g -MD -MT CMakeFiles/senses.elf.dir/Src/syscalls.c.obj -MF CMakeFiles/senses.elf.dir/Src/syscalls.c.obj.d -o CMakeFiles/senses.elf.dir/Src/syscalls.c.obj -c /home/anthony/Repositories/senses/Src/syscalls.c
/home/anthony/Repositories/senses/Src/syscalls.c:24:10: fatal error: sys/stat.h: No such file or directory
24 | #include <sys/stat.h>
| ^~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
I have installed the “gcc-arm-none-eabi” package.
Please sign in to leave a comment.
Hello!
Do you have the necessary package installed on your Linux? See this answer.