2025-07-09 9:54 PM
Today, while using the CubeMX product, I upgraded to version 6.15.0 (previously 6.14.1). After upgrade, the CMake step when generating project code failed. Even when generating an empty project, CMake still did not succeed. I also tried previously working projects that had been successfully flashed before, but they also failed during the CMake step.
The following error message was displayed:
CMake Error at D:/Program Files/JetBrains/CLion/bin/cmake/win/x64/share/cmake-3.31/Modules/CMakeTestCCompiler.cmake:67 (message): The C compiler "C:/Program Files/GNU-Arm-Toolchain-eabi/bin/arm-none-eabi-gcc.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: 'D:/project/keysking/P10_Clock/clock/cmake-build-debug/CMakeFiles/CMakeScratch/TryCompile-q0iun1' Run Build Command(s): "D:/Program Files/JetBrains/CLion/bin/ninja/win/x64/ninja.exe" -v cmTC_47519 [1/2] C:\PROGRA~1\GNU-AR~1\bin\AR19DD~1.EXE -std=gnu11 -fdiagnostics-color=always -o CMakeFiles/cmTC_47519.dir/testCCompiler.c.obj -c D:/project/keysking/P10_Clock/clock/cmake-build-debug/CMakeFiles/CMakeScratch/TryCompile-q0iun1/testCCompiler.c [2/2] C:\WINDOWS\system32\cmd.exe /C "cd . && C:\PROGRA~1\GNU-AR~1\bin\AR19DD~1.EXE CMakeFiles/cmTC_47519.dir/testCCompiler.c.obj -o cmTC_47519.exe -Wl,--out-implib,libcmTC_47519.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ." FAILED: cmTC_47519.exe C:\WINDOWS\system32\cmd.exe /C "cd . && C:\PROGRA~1\GNU-AR~1\bin\AR19DD~1.EXE CMakeFiles/cmTC_47519.dir/testCCompiler.c.obj -o cmTC_47519.exe -Wl,--out-implib,libcmTC_47519.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ." C:/PROGRA~1/GNU-AR~1/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: unrecognized option '--major-image-version' C:/PROGRA~1/GNU-AR~1/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: use the --help option for usage information 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:28 (project)
File .ioc as follows.
2025-07-09 10:08 PM
The lines
[1/2] C:\PROGRA~1\GNU-AR~1\bin\AR19DD~1.EXE -std=gnu11 -fdiagnostics-color=always -o CMakeFiles/cmTC_47519.dir/testCCompiler.c.obj -c D:/project/keysking/P10_Clock/clock/cmake-build-debug/CMakeFiles/CMakeScratch/TryCompile-q0iun1/testCCompiler.c [2/2] C:\WINDOWS\system32\cmd.exe /C "cd . && C:\PROGRA~1\GNU-AR~1\bin\AR19DD~1.EXE CMakeFiles/cmTC_47519.dir/testCCompiler.c.obj -o cmTC_47519.exe -Wl,--out-implib,libcmTC_47519.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ." FAILED: cmTC_47519.exe
show that your CMake setup tries to compile a Windows executable using the arm-none-eabi toolchain which cannot work. In short, your installation is broken. Try to clean-up and re-start from scratch. Maybe by using the tools from STM32CubeCLT - Toolset for third-party integrated development environment (IDE) providers, allowing the use of STMicroelectronics proprietary tools within their own IDE frameworks - STMicroelectronics.
hth
KnarfB
2025-07-09 10:18 PM
Thanks, I'll clean it and try again!
2025-07-09 11:43 PM
The method you suggested did not work. I have reinstalled all the software, but the error report remains the same:
-- Check for working C compiler: D:/Program Files/STM32Cube/STM32CubeCLT_1.18.0/GNU-tools-for-STM32/bin/arm-none-eabi-gcc.exe
-- Check for working C compiler: D:/Program Files/STM32Cube/STM32CubeCLT_1.18.0/GNU-tools-for-STM32/bin/arm-none-eabi-gcc.exe - broken
CMake Error at D:/Program Files/JetBrains/CLion/bin/cmake/win/x64/share/cmake-3.31/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler
"D:/Program Files/STM32Cube/STM32CubeCLT_1.18.0/GNU-tools-for-STM32/bin/arm-none-eabi-gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: 'D:/project/keysking/P10_Clock/clock/cmake-build-debug/CMakeFiles/CMakeScratch/TryCompile-yquthp'
Run Build Command(s): "D:/Program Files/JetBrains/CLion/bin/ninja/win/x64/ninja.exe" -v cmTC_063a6
[1/2] "D:\Program Files\STM32Cube\STM32CubeCLT_1.18.0\GNU-tools-for-STM32\bin\arm-none-eabi-gcc.exe" -std=gnu11 -fdiagnostics-color=always -o CMakeFiles/cmTC_063a6.dir/testCCompiler.c.obj -c D:/project/keysking/P10_Clock/clock/cmake-build-debug/CMakeFiles/CMakeScratch/TryCompile-yquthp/testCCompiler.c
[2/2] C:\WINDOWS\system32\cmd.exe /C "cd . && "D:\Program Files\STM32Cube\STM32CubeCLT_1.18.0\GNU-tools-for-STM32\bin\arm-none-eabi-gcc.exe" CMakeFiles/cmTC_063a6.dir/testCCompiler.c.obj -o cmTC_063a6.exe -Wl,--out-implib,libcmTC_063a6.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
FAILED: cmTC_063a6.exe
C:\WINDOWS\system32\cmd.exe /C "cd . && "D:\Program Files\STM32Cube\STM32CubeCLT_1.18.0\GNU-tools-for-STM32\bin\arm-none-eabi-gcc.exe" CMakeFiles/cmTC_063a6.dir/testCCompiler.c.obj -o cmTC_063a6.exe -Wl,--out-implib,libcmTC_063a6.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
D:/Program Files/STM32Cube/STM32CubeCLT_1.18.0/GNU-tools-for-STM32/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: unrecognized option '--major-image-version'
D:/Program Files/STM32Cube/STM32CubeCLT_1.18.0/GNU-tools-for-STM32/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: use the --help option for usage information
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Perhaps downgrading to version 6.14.1 might solve the issue.
2025-07-10 12:07 AM
Now I have no choice but to come back to CubeMX version 6.14.1, which is currently the only solution. I hope ST engineers can fix the issue "CubeMX 6.15.0 fails to load using CMake" as soon as possible. I look forward to experiencing the new features at the earliest opportunity.
2025-07-10 12:15 AM
Hello @Mocozzz
I'm currently investigating this .
I will get back to you as soon as possible.
THX
Ghofrane
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.