The C compiler is not able to compile a simple test program when compiling using ARM-GNU toolchain


I am trying to use cmake to generate files for an arm based stm32 board running FreeRTOS. I am using Unix Makefiles and arm-none-eabi-gcc and arm-none-eabi-g++ as C/C++ compilers but I keep getting errors such as “The C compiler is not able to compile a simple test program”.

Can someone please provide some help

@Szakmary_Szabolcs, this error typically occurs during cross-compiling when CMake attempts to test the compiler. To resolve this issue, you need to instruct CMake to utilize the static library instead.

To do so, please add the following lines to your toolchain file:

bashCopy code

# Without this flag, CMake is unable to pass the test compilation check

This configuration will enable CMake to properly handle the test compilation check during cross-compiling.

Additionally, I recommend taking a look at the following example on GitHub, which demonstrates how this solution can be implemented: