Need Help Configuring CLion for STM32 Development on macOS
Hi everyone,
I’m new to STM32 development and need some assistance in configuring CLion to work with STM32 microcontrollers.
Here’s my current setup:
STM32CubeMX: Version 6.13.0 (latest at the time of writing)
STM32CubeCLT: Version 1.17.0 (installed specifically to use the ARM toolchains it provides)
CLion: Version 2024.3.1.1 (latest at the time of writing)
macOS: Sequoia (on MacBook Pro M3), Version 15.2 (latest at the time of writing)
Problem 1: STM32CubeMX Error
When I try to create a new project in CLion using STM32CubeMX (New Project -> STM32CubeMX) and click Create, I encounter the following error:
The Eclipse executable launcher was unable to locate its companion shared library.

I’ve ensured that all my tools are installed and up to date, but I don’t understand what might be causing this issue or how I can resolve it. Any help would be appreciated!
Problem 2: ARM Toolchain Configuration and Build Failure
I specifically installed STM32CubeCLT to use the ARM toolchains provided by STMicroelectronics. I configured the following build settings in CLion:
CMake: /opt/ST/STM32CubeCLT_1.17.0/CMake/bin/cmake (Version 3.28.1)
Build Tool: /opt/ST/STM32CubeCLT_1.17.0/Ninja/bin/ninja
C Compiler: /opt/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/arm-none-eabi-gcc
C++ Compiler: /opt/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/arm-none-eabi-g++
Debugger: /opt/ST/STM32CubeCLT_1.17.0/STLink-gdb-server/bin/ST-LINK_gdbserver
Unfortunately, in the CLion toolchain settings, I receive the following errors:
C++ Compiler Test: Displays a warning: “Test CMake run finished with errors.”

I receive the following error trace:
-- The C compiler identification is GNU 12.3.1
-- The CXX compiler identification is GNU 12.3.1
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - no
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /opt/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/arm-none-eabi-gcc
-- Check for working C compiler: /opt/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/arm-none-eabi-gcc - broken
CMake Error at /opt/ST/STM32CubeCLT_1.17.0/CMake/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler
"/opt/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/arm-none-eabi-gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: '/private/var/folders/qk/kpk9_nkj34987dyl3hj74l2w0000gn/T/cmake_check_environment/_build13433262515835532785/CMakeFiles/CMakeScratch/TryCompile-ICGS0P'
Run Build Command(s): /opt/ST/STM32CubeCLT_1.17.0/Ninja/bin/ninja -v cmTC_20766
[1/2] /opt/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/arm-none-eabi-gcc -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk -fdiagnostics-color=always -o CMakeFiles/cmTC_20766.dir/testCCompiler.c.o -c /private/var/folders/qk/kpk9_nkj34987dyl3hj74l2w0000gn/T/cmake_check_environment/_build13433262515835532785/CMakeFiles/CMakeScratch/TryCompile-ICGS0P/testCCompiler.c
FAILED: CMakeFiles/cmTC_20766.dir/testCCompiler.c.o
/opt/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/arm-none-eabi-gcc -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk -fdiagnostics-color=always -o CMakeFiles/cmTC_20766.dir/testCCompiler.c.o -c /private/var/folders/qk/kpk9_nkj34987dyl3hj74l2w0000gn/T/cmake_check_environment/_build13433262515835532785/CMakeFiles/CMakeScratch/TryCompile-ICGS0P/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: 1Could anyone help me properly configure the ARM toolchain or guide me on how to resolve this error? Any advice or suggestions would be greatly appreciated!
Thank you in advance!
请先登录再写评论。
Hi Oleg!
Sorry for the delay in response.
Hi Anna
I have the same problem. The cross compiler does not recognize the '-arch' parameter. I also get an error message saying that the '-arch' parameter cannot be found when using the following command.
Is there any other solution to fix it?
Wltmlx, what compiler do you use? How did you install it?
Hi experts,
I think this issue is easy to reproduce.
1. Use CubeMX generating a project, use CMake as the export format
2. Import the project to Clion
3. Config the CubeCTL as the toolchain on Clion and compile it
The root cause is that Clion or cmake use some default settings under M-chip. For example, if you don't configure the CMAKE_OSX_ARCHITECURES option, it will use arm64 as the -arch option to compile the code.
The following is my configuration screenshot and sorry for the Chinese chars, but it can show what I said.
The original writer's log shows the problem clearly.
1.
-arch arm642.
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdkBelow is my issue. I tried to change some configuration but not work
I have found a way to bypass this issue.
Add the below block into your CMakeLists.txt of the project, after the line “cmake_minimum_required(VERSION 3.22)”. After adding the following code, please also remove the cache folder “{ProjectRootFolder}/cmake-build-debug-stm32”.