Building process failed while build with arm-none-eabi-gcc for arm plateform.
I am trying to build with arm-none-eabi-gcc with cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=arm-none-eabi-gcc ..
and it failed with the following error.
-- The C compiler identification is GNU 9.2.1
-- Check for working C compiler: /usr/bin/arm-none-eabi-gcc
-- Check for working C compiler: /usr/bin/arm-none-eabi-gcc -- broken
CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"/usr/bin/arm-none-eabi-gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/raj-priyanshu/Desktop/cmocka-1.1.5/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_f5ee3/fast && /usr/bin/make -f CMakeFiles/cmTC_f5ee3.dir/build.make CMakeFiles/cmTC_f5ee3.dir/build
make[1]: Entering directory '/home/raj-priyanshu/Desktop/cmocka-1.1.5/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_f5ee3.dir/testCCompiler.c.o
/usr/bin/arm-none-eabi-gcc -fPIE -o CMakeFiles/cmTC_f5ee3.dir/testCCompiler.c.o -c /home/raj-priyanshu/Desktop/cmocka-1.1.5/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_f5ee3
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f5ee3.dir/link.txt --verbose=1
/usr/bin/arm-none-eabi-gcc CMakeFiles/cmTC_f5ee3.dir/testCCompiler.c.o -o cmTC_f5ee3
/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): in function `exit':
/build/newlib-CVVEyx/newlib-3.3.0/build/arm-none-eabi/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/exit.c:64: undefined reference to `_exit'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_f5ee3.dir/build.make:87: cmTC_f5ee3] Error 1
make[1]: Leaving directory '/home/raj-priyanshu/Desktop/cmocka-1.1.5/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_f5ee3/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:18 (project)
-- Configuring incomplete, errors occurred!
See also "/home/raj-priyanshu/Desktop/cmocka-1.1.5/build/CMakeFiles/CMakeOutput.log".
See also "/home/raj-priyanshu/Desktop/cmocka-1.1.5/build/CMakeFiles/CMakeError.log".