This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

NCS: How to fix broken debug built?

Dear NCS experts,

When trying to debug in VSCode by hitting F5 (or Menu: Run->Start Debugging), compilation fails with: fatal error: zephyr.h: No such file or directory
The full output looks like:

> Executing task: C/C++: arm-none-eabi-gcc build active file <

Starting build...
/home/mike/nrf-dev/tools/gnuarmemb/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc -fdiagnostics-color=always -g /home/mike/nrf-dev/projects/xxx/src/main.c -o /home/mike/nrf-dev/projects/xxx/src/main
/home/mike/nrf-dev/projects/xxx/src/main.c:1:10: fatal error: zephyr.h: No such file or directory
    1 | #include <zephyr.h>
      |          ^~~~~~~~~~
compilation terminated.

Build finished with error(s).

Terminal will be reused by tasks, press any key to close it.

Beside that, an error dialog pops up, complaining that main does not exist:

launch: program '/home/mike/nrf-dev/projects/xxx/src/main' does not exist.

However, the path is correct and main.c is there... The dialog has a button labeled 'Open 'launch.json', which contains:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "arm-none-eabi-gcc - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: arm-none-eabi-gcc build active file",
            "miDebuggerPath": "/usr/bin/gdb",
            "showDevDebugOutput": true
        }
    ]
}

This happens only when trying to debug. A regular build works just fine. Any ideas how to fix this are welcome,
Thank you,
Michael.

Parents
  • Hi BlueMike,

    I found this comment:

    "For nRF Connect SDK 1.7.0 on Ubuntu you need to install the libcurses5 package to get debugging to work. This can be done by running

    sudo apt install libncurses5

    In addition CMake needs to be updated to > 3.20 according to the 1.7.0 getting started documentation".

    Best regards,

    Håkon

Reply
  • Hi BlueMike,

    I found this comment:

    "For nRF Connect SDK 1.7.0 on Ubuntu you need to install the libcurses5 package to get debugging to work. This can be done by running

    sudo apt install libncurses5

    In addition CMake needs to be updated to > 3.20 according to the 1.7.0 getting started documentation".

    Best regards,

    Håkon

Children
Related