CORTEX_MPS2_QEMU_IAR_GCC: fatal error: stdlib.h: No such file or directory

I followed the tutorial “Documentation/02-Kernel/03-Supported-devices/04-Demos/03-Emulation-and-simulation/QEMU/freertos-on-qemu-mps2-an385-model”, but when I try to build it (typing “make”) I see the error:

$ make
arm-none-eabi-gcc -ffreestanding -mthumb -mcpu=cortex-m3 -Wall -Wextra -Wshadow -g3 -Os -ffunction-sections -fdata-sections -MMD -MP -MF"output/tasks.d" -MT output/tasks.o -I./../../../../Source/include -I./../../../../Source/portable/GCC/ARM_CM3 -I./../../../../Demo/Common/include -I./../../../../Demo/CORTEX_MPS2_QEMU_IAR_GCC -I./../../../../Demo/CORTEX_MPS2_QEMU_IAR_GCC/CMSIS -c ./../../../../Source/tasks.c -o output/tasks.o
./../../../../Source/tasks.c:30:10: fatal error: stdlib.h: No such file or directory
   30 | #include <stdlib.h>
      |          ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:109: output/tasks.o] Error 1

I already did git submodule update --init --recursive and it still doesn’t work. My toolchain version is:

$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (Arch Repository) 14.1.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

P.S. I’m new to FreeRTOS project and I don’t know how that should work, sorry if this is a stupid question or a duplicate one

Hi @AlexRusuf
Welcome to the FreeRTOS Community Forums !
It seems stdio.h might be missing in this version of arm-none-eabi-gcc . I am able to build the demo using this version

arm-none-eabi-gcc --version
arm-none-eabi-gcc (15:9-2019-q4-0ubuntu1) 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599]
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

You can try installing libnewlib-arm-none-eabi to see if that fixes the issue.

1 Like

Thank you, this works for me! The only remark is that in AUR packages this one is called arm-none-eabi-newlib.

Thanks for reporting back !