arm-none-eabi-gcc test project failed



This is not a critical problem but it will be good if it can be resolved.

OS: macOS Sonoma Version 14.2.1

CLion: 2023.3.2

Compiler: arm-none-eabi-gcc (brew install -cask gcc-arm-embedded) 13.2.rel1 (Build arm-13.7) 13.2.1 20231009


In Toolchains:

CMake: Bundled 3.27.8

C Compiler: /opt/homebrew/bin/arm-none-eabi-gcc

C++ Compiler: /opt/homebrew/bin/arm-none-eabi-g++

Debugger: /opt/homebrew/bin/arm-none-eabi-gdb; Version 13.2.90


CMake error:

CMake Error at /Applications/ (message):
 The C compiler


 is not able to compile a simple test program.

 It fails with the following output:

   Change Dir: '/private/var/folders/………/cmake_check_environment1/_build4001614393476336704/CMakeFiles/CMakeScratch/TryCompile-1OZotS'
   Run Build Command(s): /Applications/ -v cmTC_e921e
   [1/2] /opt/homebrew/bin/arm-none-eabi-gcc   -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk -fdiagnostics-color=always -o CMakeFiles/cmTC_e921e.dir/testCCompiler.c.o -c /private/var/folders/…………./cmake_check_environment1/_build4001614393476336704/CMakeFiles/CMakeScratch/TryCompile-1OZotS/testCCompiler.c
   FAILED: CMakeFiles/cmTC_e921e.dir/testCCompiler.c.o 
   /opt/homebrew/bin/arm-none-eabi-gcc   -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk -fdiagnostics-color=always -o CMakeFiles/cmTC_e921e.dir/testCCompiler.c.o -c /private/var/folders/…………./cmake_check_environment1/_build4001614393476336704/CMakeFiles/CMakeScratch/TryCompile-1OZotS/testCCompiler.c
   arm-none-eabi-gcc: error: unrecognized command-line option '-arch'; did you mean '-march='?
   ninja: build stopped: subcommand failed.

 CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
 CMakeLists.txt:2 (project)

-- Configuring incomplete, errors occurred!

Error code: 1

1 comment


As a workaround, you can do the following: 

  1. Remove your arm-gcc toolchain from Preferences | Build, Execution, Deployment | Toolchains, so that there is only the "Default" toolchain.
  2. Create a CMake toolchain file (for example, gcc-arm-toolchain.cmake). You can find the example here
  3. Go to Preferences | Build, Execution, Deployment | CMake and add -DCMAKE_TOOLCHAIN_FILE=<absolute path to your toolchain file> to the "CMake options" field.

Please sign in to leave a comment.