Debugging stopped working. (*** Do not know how to make File target `debug')

Hello,

I’ve started working on a STM32F103 board using the CMSIS framework and a ST-Link/V2 probe.

I’ve been using CLion as an IDE and was able to debug my code using the ST-Link probe. After trying out other IDEs (Eclipse CDT, STMCube…) I returned to CLion and now the PlatformIO/Debug target stopped working (both when ran from CLion or from the commandline) and returns:

*** Do not know how to make File target `debug’ (/path/to/project/debug). Stop.
[FAILED] Took 0.37 seconds
make[3]: *** [CMakeFiles/Debug.dir/build.make:70: CMakeFiles/Debug] Error 1
make[2]: *** [CMakeFiles/Makefile2:113: CMakeFiles/Debug.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:120: CMakeFiles/Debug.dir/rule] Error 2

PlatformIO/Upload continues to work and I’ve managed to debug the program running ‘platformio debug --interface=gdb -x .pioinit’ in the command line.

The platformio.ini file contains:

[env:genericSTM32F103C8]
platform = ststm32
board = genericSTM32F103C8
framework = cmsis

debug_tool = stlink

and the custom targets in the CMakeLists.txt is the auto generated one reading:

add_custom_target(
Production ALL
COMMAND platformio -c clion run “$<$<NOT:$CONFIG:All>:-e${CMAKE_BUILD_TYPE}>”
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

add_custom_target(
Debug ALL
COMMAND platformio -c clion run --target debug “$<$<NOT:$CONFIG:All>:-e${CMAKE_BUILD_TYPE}>”
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

I was wondering how to troubleshoot this issue…

Thank you very much in advance,

Javier

Forgot to mention I’m using Arch Linux

I was just about to open an issue because I get the same error in Windows + CLion 2021.2.

"C:\Program Files\JetBrains\CLion 2020.2.4\bin\cmake\win\bin\cmake.exe" --build C:\Users\Max\Documents\PlatformIO\Projects\clion_debug_test\cmake-build-genericstm32f103cb --target Debug -- -j 12
Processing genericSTM32F103CB (platform: ststm32; board: genericSTM32F103CB; framework: cmsis)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F103CB.html
PLATFORM: ST STM32 (14.2.0) > STM32F103CB (20k RAM. 128k Flash)
HARDWARE: STM32F103CBT6 72MHz, 20KB RAM, 128KB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES: 
 - framework-cmsis 2.50501.200527 (5.5.1) 
 - framework-cmsis-stm32f1 4.3.1 
 - tool-ldscripts-ststm32 0.1.0 
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
*** Do not know how to make File target `debug' (C:\Users\Max\Documents\PlatformIO\Projects\clion_debug_test\debug).  Stop.
========================== [FAILED] Took 1.21 seconds ==========================
mingw32-make[3]: *** [CMakeFiles\Debug.dir\build.make:69: CMakeFiles/Debug] Error 1
mingw32-make[2]: *** [CMakeFiles\Makefile2:112: CMakeFiles/Debug.dir/all] Error 2
mingw32-make[1]: *** [CMakeFiles\Makefile2:119: CMakeFiles/Debug.dir/rule] Error 2
mingw32-make: *** [Makefile:136: Debug] Error 2

But then I decided to read the documentation regarding this paragraph that says

Remove pre-task (“Build”) from PlatformIO Upload and PlatformIO Debug configurations to avoid double project building. You should see “There are no tasks to run before launch”.

So if I do that

Amd that started working

3 Likes

Thanks for the reply. I can confirm that it also works in my system and can debug the code.

After further investigation, I see that the problem is that it fails when trying to build the project while the debug target is selected. I don’t remember this being the case before and it doesn’t happen when I tried an equivalent project using Visual Studio Code (also in Linux). I feel it is more a workaround than a fix to the underlying problem.

@Javiergg agreed, this is very recent.

I’ve hit this recently too, I originally thought it was a clion bug (see https://youtrack.jetbrains.com/issue/CPP-26736 where I fully documented the behaviour with logs and versions). However, on reflection, I don’t think it’s a clion issue because it builts perfectly and repeatedly with 5.1.0, and then never works on 5.2.0. Same version of Clion.

I originally removed the build task option in clion, but I think that causes subtle problems too, but it was so long ago that I will try it again and report back if I see any issues from doing so.

Thanks for reporting, the fix is on it’s way.

1 Like

Please re-test with

  • pio upgrade --dev
  • pio project init --ide clion
  • Restart CLion.

Does it work now?

I’m running CLion 2021.3.2 on Mac with Monterey 12.1 and platformio 5.2.4 installed from homebrew and pip and the getPlatformio.py script. When I do a buid from the Tools/Platformio menu, I get *** Do not know how to make File target `debug’ (/Users/jbasiago/Development/C++/LayoutSurveyor/debug). I’ve run the commands you listed last from the terminal in CLion, then restarted Clion and I still get the debug message. I am able to build the project using the build button on the configuration options. I’ve been using CLion with platformio for about a year and never had these problems before. Today I ran into some build issues and had to reinstall and upgrade platformio. I’m still able to work, but this feature use to work.

Thanks.

I’m facing the same issue for a second day now. The project was working before I changed to the different board.

I took every proposed steps multiple times. I’ve reinstalled PlatformIO, regenerated CMakeLists/Private.txt files, removed and cretaed .pio and .cache and reinitiated pio project with no luck.

This is my config file

[platformio]
build_cache_dir = C:\Users\Temur\CLionProjects\ChordWave\.cache

[env:espwroom32]
platform = espressif32
board = upesy_wroom
framework = arduino
lib_deps =
    Wire
    olikraus/U8g2@^2.34.18
    chris--a/Keypad@^3.1.1
    einararnason/ArduinoQueue@^1.2.5
monitor_speed = 115200

This is what I get when trying to build the project:

C:\Users\Temur\.platformio\penv\Scripts\platformio.exe -c clion run --target debug -e espwroom32
********************************************************************************
Obsolete PIO Core v6.1.8a1 is used (previous was 6.1.8b2)
Please remove multiple PIO Cores from a system:
https://docs.platformio.org/en/latest/core/installation/troubleshooting.html
********************************************************************************
Processing espwroom32 (platform: espressif32; board: upesy_wroom; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/upesy_wroom.html
PLATFORM: Espressif 32 (6.3.2) > uPesy ESP32 Wroom DevKit
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.20009.0 (2.0.9) 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 36 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Wire @ 2.0.0
|-- U8g2 @ 2.34.22
|-- Keypad @ 3.1.1
|-- ArduinoQueue @ 1.2.5
Building in release mode
*** Do not know how to make File target `debug' (C:\Users\Temur\CLionProjects\ChordWave\debug).  Stop.
========================== [FAILED] Took 2.09 seconds ==========================

Process finished with exit code 1

I have the most up to date version of both CLion and Plugin. What can I do to debug this issue further?