CMAKE build works only in IDE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-31 5:01 AM
Hello,
I have successfully created a new cmake project in IDE 1.16. Everything I need works - the project is successfully compiled, the BIN file is successfully run in the MCU:
[ 97%] Building C object CMakeFiles/KubergCMAKE.dir/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_uart_ex.c.obj
[100%] Linking C executable KubergCMAKE.elf
text data bss dec hex filename
48528 128 3376 52032 cb40 C:/Projekty/KubergCMAKE/Release/KubergCMAKE.elf
[100%] Built target KubergCMAKE
13:57:54 Build Finished. 0 errors, 0 warnings. (took 16s.631ms)
However, I am unable to compile the project from the command line window.
cmake --build Release
This command only succesfuly compile source files - 100% done, but when try to lining:
[100%] Linking C executable KubergCMAKE.elf
ends with this error:
.......
............
CMakeFiles/KubergCMAKE.dir/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_uart_ex.c.obj : No such file or directory
collect2.exe: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/KubergCMAKE.dir/build.make:639: KubergCMAKE.elf] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/KubergCMAKE.dir/all] Error 2
Has anyone solved the same problem?
Thank You, Jan.
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-08-01 4:25 AM
Hello @JKol
I suggest that you delete the Debug folder and rebuild the project with command line below:
cmake -DCMAKE_TOOLCHAIN_FILE=cubeide-gcc.cmake -S ./ -B Debug -GUnix -DCMAKE_BUILD_TYPE=Debug
cmake --build Debug --clean-first
It seems that the project was built using an older version of CubeIDE.
KR,
Souhaib
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-31 9:00 AM
Hello @JKol ,
First let me thank you for posting!
I am not able to reproduce your issue in my side,
Could you add your project for further investigation.
Thx,
Souhaib
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-31 10:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-08-01 4:25 AM
Hello @JKol
I suggest that you delete the Debug folder and rebuild the project with command line below:
cmake -DCMAKE_TOOLCHAIN_FILE=cubeide-gcc.cmake -S ./ -B Debug -GUnix -DCMAKE_BUILD_TYPE=Debug
cmake --build Debug --clean-first
It seems that the project was built using an older version of CubeIDE.
KR,
Souhaib
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-08-01 4:46 AM
Hello Souhaib,
thanks a lot it's working :-). I only
1. added the path to compiler files to PATH variable:
c:\ST\STM32CubeIDE_1.13.2\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.200.202406191623\tools\bin
2. changed cmake command:
cmake -DCMAKE_TOOLCHAIN_FILE=cubeide-gcc.cmake -S ./ -B Debug -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
Best regards,
Jan.
