microsoft / microsoft/vscode-cmake-tools

Cmake Tools icorrectly parsing cmake build errors output

Open
#1,898 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Feature: build
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

When cmake build produces error, cmake tools produces weird symbols and path to the file is incorrect in Problems window:

Cmake Tools output:

[proc] Executing command: /usr/bin/cmake --build /home/mvankovych/cpp/projects/cpp_starter_project/build --config Debug --target GuiQt -j 14 --
[build] [ 20%] Automatic MOC for target GuiQt
[build] [ 20%] Built target GuiQt_autogen
[build] Scanning dependencies of target GuiQt
[build] [ 40%] Building CXX object src/gui_qt/CMakeFiles/GuiQt.dir/GuiQt.cpp.o
[build] /home/mvankovych/cpp/projects/cpp_starter_project/src/gui_qt/GuiQt.cpp:1:10: fatal error: 'Guit.hpp' file not found
[build] #include "Guit.hpp"
[build]          ^~~~~~~~~~
[build] 1 error generated.
[build] make[3]: *** [src/gui_qt/CMakeFiles/GuiQt.dir/build.make:89: src/gui_qt/CMakeFiles/GuiQt.dir/GuiQt.cpp.o] Error 1
[build] make[2]: *** [CMakeFiles/Makefile2:277: src/gui_qt/CMakeFiles/GuiQt.dir/all] Error 2
[build] make[1]: *** [CMakeFiles/Makefile2:284: src/gui_qt/CMakeFiles/GuiQt.dir/rule] Error 2
[build] make: *** [Makefile:194: GuiQt] Error 2
[build] Build finished with exit code 2

Problems window error entry:

{
	"resource": "/home/mvankovych/cpp/projects/cpp_starter_project/build/\u001b[1m/home/mvankovych/cpp/projects/cpp_starter_project/src/gui_qt/GuiQt.cpp:1",
	"owner": "cmake-build-diags",
	"severity": 8,
	"message": "\u001b[0m\u001b[0;1;31mfatal error: \u001b[0m\u001b[1m'Guit.hpp' file not found\u001b[0m",
	"source": "link",
	"startLineNumber": 10,
	"startColumn": 1,
	"endLineNumber": 10,
	"endColumn": 1000
}

Running cmake from terminal:

[ 20%] Automatic MOC for target GuiQt
[ 20%] Built target GuiQt_autogen
[ 40%] Building CXX object src/gui_qt/CMakeFiles/GuiQt.dir/GuiQt.cpp.o
/home/mvankovych/cpp/projects/cpp_starter_project/src/gui_qt/GuiQt.cpp:1:10: fatal error: 'Guit.hpp' file not found
#include "Guit.hpp"
         ^~~~~~~~~~
1 error generated.
make[3]: *** [src/gui_qt/CMakeFiles/GuiQt.dir/build.make:89: src/gui_qt/CMakeFiles/GuiQt.dir/GuiQt.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:277: src/gui_qt/CMakeFiles/GuiQt.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:284: src/gui_qt/CMakeFiles/GuiQt.dir/rule] Error 2
make: *** [Makefile:194: GuiQt] Error 2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the shown CMake build output and trace the diagnostic parsing entry point used for the Problems window. Compare the terminal diagnostics with the generated resource, message, and line fields. Done means ANSI escape sequences are removed and the source path, message, and location are parsed correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, typescript
Domain
build-system, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.