Hello, I am trying to set up a Cmake project to work with Clion, which is built around Cmake. For that I am using the folowing tool: https://mcuxpresso.nxp.com/en/select. I selected the ARM gcc toolchain and I am trying to run examples but I get the follwing error:
"C:\Program Files\JetBrains\CLion 2023.1.5\bin\cmake\win\x64\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_MAKE_PROGRAM=C:/Program Files/JetBrains/CLion 2023.1.5/bin/ninja/win/x64/ninja.exe" -G Ninja -S C:\Users\Usuario\Downloads\led_blinky -B C:\Users\Usuario\Downloads\led_blinky\cmake-build-debug
-- The ASM compiler identification is GNU
-- Found assembler: C:/Program Files/JetBrains/CLion 2023.1.5/bin/mingw/bin/gcc.exe
-- The C compiler identification is GNU 13.1.0
-- The CXX compiler identification is GNU 13.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files/JetBrains/CLion 2023.1.5/bin/mingw/bin/gcc.exe
-- Check for working C compiler: C:/Program Files/JetBrains/CLion 2023.1.5/bin/mingw/bin/gcc.exe - works
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: C:/Program Files/JetBrains/CLion 2023.1.5/bin/mingw/bin/g++.exe
-- Check for working CXX compiler: C:/Program Files/JetBrains/CLion 2023.1.5/bin/mingw/bin/g++.exe - works
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at all_lib_device.cmake:281 (include_if_use):
Unknown CMake command "include_if_use".
Call Stack (most recent call first):
CMakeLists.txt:63 (include)
-- Configuring incomplete, errors occurred!
Cannot get compiler information:
Compiler exited with error code 1: C:\Program Files\JetBrains\CLion 2023.1.5\bin\mingw\bin\gcc.exe -xc -g -DDEBUG -DCPU_LPC845M301JBD48 -DMCUXPRESSO_SDK -g -O0 -mcpu=cortex-m0plus -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -std=gnu99 -DSDK_DEBUGCONSOLE=1 -fpch-preprocess -v -dD -E
gcc.exe: warning: '-mcpu=' is deprecated; use '-mtune=' or '-march=' instead
Using built-in specs.
COLLECT_GCC=C:\Program Files\JetBrains\CLion 2023.1.5\bin\mingw\bin\gcc.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-13.1.0/configure --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --build=x86_64-alpine-linux-musl --prefix=/win --enable-checking=release --enable-fully-dynamic-string --enable-languages=c,c++ --with-arch=nocona --with-tune=generic --enable-libatomic --enable-libgomp --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --enable-seh-exceptions --enable-shared --enable-static --enable-threads=posix --enable-version-specific-runtime-libs --disable-bootstrap --disable-graphite --disable-libada --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-libquadmath --disable-lto --disable-nls --disable-multilib --disable-rpath --disable-symvers --disable-werror --disable-win32-registry --with-gnu-as --with-gnu-ld --with-system-libiconv --with-system-libz --with-gmp=/win/makedepends --with-mpfr=/win/makedepends --with-mpc=/win/makedepends
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.1.0 (GCC)
COLLECT_GCC_OPTIONS='-g' '-D' 'DEBUG' '-D' 'CPU_LPC845M301JBD48' '-D' 'MCUXPRESSO_SDK' '-g' '-O0' '-mtune=cortex-m0plus' '-Wall' '-fno-common' '-ffunction-sections' '-fdata-sections' '-ffreestanding' '-fno-builtin' '-std=gnu99' '-D' 'SDK_DEBUGCONSOLE=1' '-fpch-preprocess' '-v' '-dD' '-E' '-D' '___CIDR_DEFINITIONS_END' '-march=nocona'
C:/Program Files/JetBrains/CLion 2023.1.5/bin/mingw/bin/../libexec/gcc/x86_64-w64-mingw32/13.1.0/cc1.exe -E -quiet -v -iprefix C:/Program Files/JetBrains/CLion 2023.1.5/bin/mingw/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/ -D_REENTRANT -D DEBUG -D CPU_LPC845M301JBD48 -D MCUXPRESSO_SDK -D SDK_DEBUGCONSOLE=1 -D ___CIDR_DEFINITIONS_END C:\Users\Usuario\AppData\Local\Temp\compiler-file18072789592995997676 -mtune=cortex-m0plus -march=nocona -std=gnu99 -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -fpch-preprocess -g -g -fworking-directory -O0 -dD -dumpbase compiler-file18072789592995997676
ignoring duplicate directory "C:/Program Files/JetBrains/CLion 2023.1.5/bin/mingw/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/13.1.0/include"
ignoring nonexistent directory "/win/include"
ignoring duplicate directory "C:/Program Files/JetBrains/CLion 2023.1.5/bin/mingw/lib/gcc/../../include"
ignoring duplicate directory "C:/Program Files/JetBrains/CLion 2023.1.5/bin/mingw/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/13.1.0/include-fixed"
ignoring duplicate directory "C:/Program Files/JetBrains/CLion 2023.1.5/bin/mingw/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
C:/Program Files/JetBrains/CLion 2023.1.5/bin/mingw/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/include
C:/Program Files/JetBrains/CLion 2023.1.5/bin/mingw/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../include
C:/Program Files/JetBrains/CLion 2023.1.5/bin/mingw/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/include-fixed
C:/Program Files/JetBrains/CLion 2023.1.5/bin/mingw/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/include
End of search list.
cc1.exe: error: bad value 'cortex-m0plus' for '-mtune=' switch
cc1.exe: note: valid arguments to '-mtune=' switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client rocketlake icelake-server cascadelake tigerlake cooperlake sapphirerapids emeraldrapids alderlake raptorlake meteorlake graniterapids bonnell atom silvermont slm goldmont goldmont-plus tremont sierraforest grandridge knl knm intel x86-64 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 lujiazui k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 znver3 znver4 btver1 btver2 generic native
I don't trust clion that much with that config because it is configured to use MinGW, but if I make it use arm gnu toolchain I get the following error:
"C:\Program Files\JetBrains\CLion 2023.1.5\bin\cmake\win\x64\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_MAKE_PROGRAM=C:/Program Files/JetBrains/CLion 2023.1.5/bin/ninja/win/x64/ninja.exe" "-DCMAKE_C_COMPILER=C:/Program Files/arm-gnu-toolchain-12.3.rel1-mingw-w64-i686-arm-none-eabi/bin/arm-none-eabi-gcc.exe" "-DCMAKE_CXX_COMPILER=C:/Program Files/arm-gnu-toolchain-12.3.rel1-mingw-w64-i686-arm-none-eabi/bin/arm-none-eabi-g++.exe" -G Ninja -S C:\Users\Usuario\Downloads\led_blinky -B C:\Users\Usuario\Downloads\led_blinky\cmake-build-debug-arm
-- The ASM compiler identification is GNU
-- Found assembler: C:/Program Files/arm-gnu-toolchain-12.3.rel1-mingw-w64-i686-arm-none-eabi/bin/arm-none-eabi-gcc.exe
-- The C compiler identification is GNU 12.3.1
-- The CXX compiler identification is GNU 12.3.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files/arm-gnu-toolchain-12.3.rel1-mingw-w64-i686-arm-none-eabi/bin/arm-none-eabi-gcc.exe
-- Check for working C compiler: C:/Program Files/arm-gnu-toolchain-12.3.rel1-mingw-w64-i686-arm-none-eabi/bin/arm-none-eabi-gcc.exe - broken
CMake Error at C:/Program Files/JetBrains/CLion 2023.1.5/bin/cmake/win/x64/share/cmake-3.26/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler
"C:/Program Files/arm-gnu-toolchain-12.3.rel1-mingw-w64-i686-arm-none-eabi/bin/arm-none-eabi-gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Usuario/Downloads/led_blinky/cmake-build-debug-arm/CMakeFiles/CMakeScratch/TryCompile-7aqh1i
Run Build Command(s):C:/Program Files/JetBrains/CLion 2023.1.5/bin/ninja/win/x64/ninja.exe -v cmTC_94028 && [1/2] C:\PROGRA~1\ARM-GN~1.REL\bin\AR19DD~1.EXE -fdiagnostics-color=always -o CMakeFiles/cmTC_94028.dir/testCCompiler.c.obj -c C:/Users/Usuario/Downloads/led_blinky/cmake-build-debug-arm/CMakeFiles/CMakeScratch/TryCompile-7aqh1i/testCCompiler.c
[2/2] cmd.exe /C "cd . && C:\PROGRA~1\ARM-GN~1.REL\bin\AR19DD~1.EXE CMakeFiles/cmTC_94028.dir/testCCompiler.c.obj -o cmTC_94028 && cd ."
FAILED: cmTC_94028
cmd.exe /C "cd . && C:\PROGRA~1\ARM-GN~1.REL\bin\AR19DD~1.EXE CMakeFiles/cmTC_94028.dir/testCCompiler.c.obj -o cmTC_94028 && cd ."
c:/progra~1/arm-gn~1.rel/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~1/arm-gn~1.rel/bin/../lib/gcc/arm-none-eabi/12.3.1\libc.a(libc_a-exit.o): in function `exit':
exit.c:(.text.exit+0x28): undefined reference to `_exit'
c:/progra~1/arm-gn~1.rel/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~1/arm-gn~1.rel/bin/../lib/gcc/arm-none-eabi/12.3.1\libc.a(libc_a-closer.o): in function `_close_r':
closer.c:(.text._close_r+0x18): undefined reference to `_close'
c:/progra~1/arm-gn~1.rel/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~1/arm-gn~1.rel/bin/../lib/gcc/arm-none-eabi/12.3.1\libc.a(libc_a-lseekr.o): in function `_lseek_r':
lseekr.c:(.text._lseek_r+0x24): undefined reference to `_lseek'
c:/progra~1/arm-gn~1.rel/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~1/arm-gn~1.rel/bin/../lib/gcc/arm-none-eabi/12.3.1\libc.a(libc_a-readr.o): in function `_read_r':
readr.c:(.text._read_r+0x24): undefined reference to `_read'
c:/progra~1/arm-gn~1.rel/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~1/arm-gn~1.rel/bin/../lib/gcc/arm-none-eabi/12.3.1\libc.a(libc_a-writer.o): in function `_write_r':
writer.c:(.text._write_r+0x24): undefined reference to `_write'
c:/progra~1/arm-gn~1.rel/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~1/arm-gn~1.rel/bin/../lib/gcc/arm-none-eabi/12.3.1\libc.a(libc_a-sbrkr.o): in function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0x18): undefined reference to `_sbrk'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:33 (project)
-- Configuring incomplete, errors occurred!
[Failed to reload]
Hello @AgustinOrdonez
Sorry I haven't used Clion, how about searching method take error message as keyword on Clion support.
BR
Alice