Skip to main content
Associate II
February 6, 2026
Question

STMStudio error: “Wrong version in compilation unit header (is 5 should be 2, 3, or 4)” with CMake

  • February 6, 2026
  • 1 reply
  • 191 views

I am building an STM32H7 project (STM32H753) using CMake + STM32CubeMX and GCC.
The firmware builds and runs correctly, but STMStudio fails to load debug symbols with the following error:

DWARF error. Wrong version in compilation unit header (is 5, should be 2,3 or 4)

 

Even when -g is used, the error persists. I set the following flags on CMakeLists:

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gdwarf-4")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -gdwarf-4")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gdwarf-4")

 

So, I appreciate any advice.

 

    1 reply

    Visitor II
    February 19, 2026

    tengo el mismo problema