Just started using CMake for cross compilation of a library for ARM cortex M7.
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../.CMake/toolchain_armcortexm7.cmake -DOQS_USE_OP ENSSL=OFF ..
When running the cmake build, it first checks if the compiler is able to "compile a simple test program" where I get the following error:
/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'
Which should be solved by this solution
add_compile_options(--specs=nosys.specs)
But this option is apparently not passed to the compiler test [2/2]. Why?
Run Build Command(s):/usr/bin/ninja cmTC_0edfd && [1/2] Building C object CMakeFiles/cmTC_0edfd.dir/testCCompiler.c.o
[2/2] Linking C executable cmTC_0edfd
FAILED: cmTC_0edfd
: && /usr/bin/arm-none-eabi-gcc CMakeFiles/cmTC_0edfd.dir/testCCompiler.c.o -o cmTC_0edfd && :
/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'
If I were to misspell the compiler option, the test [1/2] fails and includes the correct flags
Run Build Command(s):/usr/bin/ninja cmTC_65be3 && [1/2] Building C object CMakeFiles/cmTC_65be3.dir/testCCompiler.c.o
FAILED: CMakeFiles/cmTC_65be3.dir/testCCompiler.c.o
/usr/bin/arm-none-eabi-gcc --specs=nosys. -mcpu=cortex-m7 -g3 -DSTM32F746xx -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -mfpu=fpv5-sp-d16 -mfloat-abi=soft -mthumb -o CMakeFiles/cmTC_65be3.dir/testCCompiler.c.o -c testCCompiler.c
arm-none-eabi-gcc: fatal error: cannot read spec file 'nosys.': No such file or directory