Bug 354143 - Unclear output when building cpp project using cmake
Summary: Unclear output when building cpp project using cmake
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Build tools: CMake (show other bugs)
Version: git master
Platform: Mageia RPMs Linux
: NOR normal
Target Milestone: 5.0.0
Assignee: kdevelop-bugs-null
URL:
Keywords: regression, release_blocker
: 330205 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-10-20 20:28 UTC by Piotr Mierzwinski
Modified: 2016-10-07 08:57 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.0.0


Attachments
kate_build_kdevelop_output (78.87 KB, image/png)
2015-11-02 21:29 UTC, Piotr Mierzwinski
Details
kate_build_kdevelop_cmake_first_start (10.51 KB, text/plain)
2015-11-02 21:29 UTC, Piotr Mierzwinski
Details
kate_build_terminal_make_-j2 (77.21 KB, text/plain)
2015-11-02 21:30 UTC, Piotr Mierzwinski
Details
kate_build_kdevelop_make_result (97.56 KB, text/plain)
2015-11-02 21:31 UTC, Piotr Mierzwinski
Details
qtcmd2_build_kdevelop4_output (pretty output generated by KDevelop4) (174.53 KB, image/png)
2015-11-02 21:40 UTC, Piotr Mierzwinski
Details
qtcmd_build (jobs: 2, 4, 8) (2.99 KB, application/gzip)
2015-12-01 03:48 UTC, Piotr Mierzwinski
Details
kdevelop build output (jobs: 2, 4, 8) (22.74 KB, application/gzip)
2015-12-01 03:49 UTC, Piotr Mierzwinski
Details
qtcmd2_build_j4_terminal_output (18.37 KB, text/plain)
2015-12-01 03:50 UTC, Piotr Mierzwinski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Mierzwinski 2015-10-20 20:28:05 UTC
Output (in "Build" view) produced by KDevelop when cpp project (cmake based) is building isn't clear comparing to this one produced by KDevelop 4.7.x. I mean that when I'm building project in the newest unstable KDevelop I'm getting a lot of the same lines (referring only to directory where is placed build file) and sometime is appearing percentage value (probably only when directory is changed). This causes that I'm not able to recognize what file is currently built. Please note that when I call building from terminal (invoking make) then I'm getting pretty output with totally percentage progress printed on beginning every build file, additionally in every line is showing currently building file name.

Is it possible (in the newest KDevelop) to produce the same output during building (cpp project) like in KDevelop 4.7.x?

Reproducible: Always

Steps to Reproduce:
1. Run KDevelop with any project
2. Change couple of files
3. Invoke building
4. Take a look at "Build" view

Actual Results:  
A lot of the same lines showing only directory where is currently built file.
Percentage progress is showing as far as I remember only when directory is changed

Expected Results:  
The same output like in KDevelop 4.7.x

I tested with project based on git revision system.
KDevelop was cloned about 1 week ago.
Comment 1 Kevin Funk 2015-10-21 12:52:40 UTC
Seen that, too. That's a regression we need to investigate. IIRC it only happens with Unix Makefiles.
Comment 2 Milian Wolff 2015-11-01 17:01:15 UTC
I cannot reproduce this issue. Can you please provide a test project and clear instructions of what to do to reproduce the problem?
Comment 3 Piotr Mierzwinski 2015-11-02 21:28:22 UTC
Maybe I wasn't clear in my first description. OK. I'll try to fix it.
I have cloned kate (master branch) and I'll try to demonstrate you in detailed steps how to reproduce this issue.

Used tools:
All Kate, KDevelop and KDevPlatform was cloned at 28.10.2015 and were built using:
$ cmake --version
cmake version 3.4.0-rc2
$ gcc --version
gcc (GCC) 5.2.1 20151020
$ rpm -qa | grep llvm
libllvm-devel-3.7.0-2.mga6
llvm-3.7.0-2.mga6
libllvm3.7-3.7.0-2.mga6
$ rpm -qa | grep clang
libclang3.7.0-3.7.0-2.mga6
libclang-devel-3.7.0-2.mga6

Steps to reproduce:
1. create new user, let it be: "testkdev" (name of course is not matter)
2. login on him into Plasma5 session
3. run KDevelop 4.90.90
   Now we are sure that every settings in KDevelop are set as default.
   By the way. Minor bug: There is no any edge menu-labels after first start, some (not all checked in configuration) appearing after KDevelop restart.
4. In KDevelop please open cloned Kate project
    Cloned project ensure that it will be clear (without any project dir and file: ".kdev4" and without build directory)
    Opening please always select default values, so:
     - in first window please choose CMakeLists.txt and press Next
     - in second window: "Project Information -> Build System" should be set CMake Build Manager; Name: kate
       Press "Finish".
     - in third window  "CMake Binary" and "Build Directory" should be set properly, and "Build Type:" set as Debug
       Pressing OK should run cmake
    Project -> Open configuration all is default:
    * In "Language Support" I have following values:
     - Includes/Imports: empty
     - Defines: empty
     - Compilers: Auto detected -> gcc
     - C/C++ parser: Predefined profile -> C++11
    "Reparse project" is checked.  Compiler for path: GCC
    * In "Make" I have following values:
     - Abort of first error: checked
     - Number of simultaneous jobs: 2
     - Make executable: make
     - Active environment profile: default
   * In CMake: everything default
     If you need I can provide all my default settings (as screen-shots)
5. Press "Build" button to start building

Screen-shots
Last part of output I attached as screen-shot: "kate_build_kdevelop_output"
Additionally I attached:
- output (txt) for first run of cmake (I get here a lot of warnings): "kate_build_kdevelop_cmake_first_start"
- output (txt) produced by KDevelop during building: "kate_build_kdevelop_make_result"
- output (txt) produced by make -j2 command (run in konsole) during building: "kate_build_terminal_make_-j2" (sorry for only 999 lines, begin is no so much important, I think)

Now just please look at output produced by make command (run in konsole) - on the left edge there is percentage progress printing in mostly lines. Similar result I get in KDevelop4.7.x, whilst in KDevelop5 percentage progress is very rare. End of both files gives the best comparison.
Comment 4 Piotr Mierzwinski 2015-11-02 21:29:05 UTC
Created attachment 95271 [details]
kate_build_kdevelop_output
Comment 5 Piotr Mierzwinski 2015-11-02 21:29:41 UTC
Created attachment 95272 [details]
kate_build_kdevelop_cmake_first_start
Comment 6 Piotr Mierzwinski 2015-11-02 21:30:09 UTC
Created attachment 95273 [details]
kate_build_terminal_make_-j2
Comment 7 Piotr Mierzwinski 2015-11-02 21:31:14 UTC
Created attachment 95274 [details]
kate_build_kdevelop_make_result
Comment 8 Piotr Mierzwinski 2015-11-02 21:40:34 UTC
Created attachment 95275 [details]
qtcmd2_build_kdevelop4_output (pretty output generated by KDevelop4)
Comment 9 Piotr Mierzwinski 2015-11-04 20:09:30 UTC
As Kevin mentioned "it only happens with Unix Makefiles".
Properly configuration for this is following: Setting -> Configure KDevelop -> CMake -> Generator set on value "Unix Makefiles".
Comment 10 Milian Wolff 2015-11-12 13:34:56 UTC
now I finally see the issue :)

the lines like "build foo" don't show the progress in our custom build output. Only moc and link steps seem to show it.
Comment 11 Kevin Funk 2015-11-27 19:34:15 UTC
Git commit 7cf9810c44b75d4123b6f65150400a1d0296c0ea by Kevin Funk.
Committed on 27/11/2015 at 19:33.
Pushed by kfunk into branch '5.0'.

Fix CMake compilation output parsing
FIXED-IN: 5.0.0

M  +5    -2    outputview/outputfilteringstrategies.cpp
M  +5    -5    outputview/tests/test_filteringstrategy.cpp

http://commits.kde.org/kdevplatform/7cf9810c44b75d4123b6f65150400a1d0296c0ea
Comment 12 Piotr Mierzwinski 2015-12-01 03:43:55 UTC
Sorry, but for me this is not fixed. I expected quite different output. I mean output like this generated by KDevelop4 - attachment: "qtcmd2_build_kdevelop4_output (pretty output generated by KDevelop4" or same like is produced in terminal: attachment "kate_build_terminal_make_-j2". Other are wrong. Thus such output where in almost every lines I get percentage indicator. After this fix I get periodically percentage indicator. 
I made the tests with my project (qtcmd2) and with yours: kdevelop.
I tested building with 2, 4, and 8 jobs.

Before building I've checked only one plugin referring to build:
* Settings -> Plugins: "Build project by CMake"
In option "Loaded plugins" also there was visible "Building by make" despite in "Configure plugins" is unchecked. The most likely one is dependent on the second, so that's mean lack of consistency or minor bug.

* Project configuration:
Default cmake executable: /usr/bin/cmake
(but after pressing OK it has been reset to empty value - It doesn't matter because cmake works)
Generator: Unix Makefile

Configure cmake settings:
QT_QMAKE_EXECUTABLE  /usr/bin/qmake-qt4

Configure Make settings:
- test1: "Number of simultaneous jobs:" 8
- test2: "Number of simultaneous jobs:" 4
- test3: "Number of simultaneous jobs:" 2

Make executable:  make
Active environment profile:  default

In kdevelop case percentage indicator appeared only with only following lines:
[  6%] Automatic moc for target test_gdb
[ 52%] Linking CXX executable debugeeqt

In my project
[ 37%] Scanning dependencies of target qtcmd2tarsubsystem
[ 61%] Linking CXX shared library 
When I built using 2 jobs then there wasn't no one percentage indicator (despite there were "Scanning dependencies..." strings in output).

And if you check attachments you will see that not everyone matching (to above template) lines have percentage indicator :/. So it means that this is randomly :(. Second issue is that sometimes lines are starting with a capital letter and sometimes not. Building in terminal I didn't notice it.

This test I've made on Kubuntu 15.10 with following tools:
# cmake --version
cmake version 3.2.2
# make --version
GNU Make 4.0
# gcc --version
gcc (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010

On the end I built my project being in terminal - attachment: "qtcmd2_build_j4_terminal_output". Thanks that I found where is the bug. It turned out that percentage indicator is displayed with lines where should not be displayed. There is in "Scanning dependencies" and should be for example in "Building ...". There is in every place where should not be.
Comment 13 Piotr Mierzwinski 2015-12-01 03:46:54 UTC
kdevelop and kdevplatform cloned at 30/11/2015 (branch 5.0).
Comment 14 Piotr Mierzwinski 2015-12-01 03:48:20 UTC
Created attachment 95831 [details]
qtcmd_build (jobs: 2, 4, 8)
Comment 15 Piotr Mierzwinski 2015-12-01 03:49:24 UTC
Created attachment 95832 [details]
kdevelop build output (jobs: 2, 4, 8)
Comment 16 Piotr Mierzwinski 2015-12-01 03:50:13 UTC
Created attachment 95833 [details]
qtcmd2_build_j4_terminal_output
Comment 17 Kevin Funk 2015-12-01 09:56:31 UTC
You're right, the percentage is stripped from the output.

Honestly, the filterting system is flawed, and personally I'd like to get rid off it completely. We still *may* parse and interpret the output, but we should *not* rewrite it at all.

tl;dr, I'm very much in favor of removing any output rewriting in KDevelop. Do other devs agree?
Comment 18 Piotr Mierzwinski 2015-12-01 12:55:51 UTC
To avoid misunderstanding. We are talking here about view called: "Build". And I wasn't in mind any filtering - meaning putting something in edit box placed on top of this view.

> ... the filterting system is flawed
I'm not sure what filtering your are talking about :/.
I would like to get pretty output during build the project. The same like in KDevelop4. The same like I can see in terminal when I run make command. I attached examples. In KDevelop5 this still (after your last fix) doesn't work correct.
If you want to "get rid off it completely" filtering described by me on top of this message then I don't mind. I don't use it at all.
Very often I use filtering placed in "Run" view. And by the way it still doesn't work well. Soon I will report the bug.

And back to the problem.
For me this bug looks like mistake in some condition using in code to producing this output. Considering my description in previous post, I think enough would be just reversing some condition and all would be fine. Sorry, I'm not aware of code, so this is only guess. Similar like the further thinking.

I'm not sure what you mean when you are talking "rewrite". 
I think compiler/make command returns its output somewhere (maybe to some QString buffer if you are using QProcess to run compiler/make command) and KDevelop just filters and prints it. So it is just sending not rewriting. What is the problem in the correct return of output produced by make command (in KDevelop5)?

In my opinion - "fixing by removing" not always is good approach to solve the problem. This is limiting the functionality what was working before.
Comment 19 Kevin Funk 2015-12-01 15:09:30 UTC
@Piotr: With "filtering" I dont mean a search box.

With filtering I mean the mechanism in KDevelop that filters any run/build output in KDevelop. For instance we parse the build output of a simple 'make' run, and then reformat it before displaying it in the Build pane. This reformatting should be removed IMO, as it makes the output of 'make' in KDevelop differ from what you'd expect (and what you actually get when running it in terminal).
Comment 20 Piotr Mierzwinski 2015-12-01 17:24:30 UTC
Thanks for explanation. Now "filtering" is clear :).

I don't remember that you faced with that in KDevelop4.
Do I understand that this mechanism has been introduced in KDevelop 5? And If yes then why? What was the goal of it?
As far as I know in eclipse there is plugin which allow to define filtering rules (coloring, bold, etc.). Is this was your intention?
Comment 21 Milian Wolff 2015-12-01 22:41:48 UTC
I'm in favor of removing the rewriting.

and no, afaik it's not a new feature, it probably just got applied in to more areas in kf5.
Comment 22 Kevin Funk 2016-01-08 21:16:24 UTC
Git commit 596d64310d7a01ba24326c802e29b799443095f6 by Kevin Funk.
Committed on 08/01/2016 at 21:15.
Pushed by kfunk into branch '5.0'.

OutputView: Remove output rewriting feature

Just show the plain output to the users, as he would see when invoking
the build tool inside the terminal.

Don't rewrite the output, always show the full output. I don't think
there's a reason to support rewriting the output altogether, it's only
misleading for the user.

As discussed in bug 354143
Related: bug 194403
FIXED-IN: 5.0.0

Differential Revision: https://phabricator.kde.org/D757

M  +0    -2    outputview/filtereditem.cpp
M  +0    -1    outputview/filtereditem.h
M  +19   -40   outputview/outputfilteringstrategies.cpp
M  +4    -8    outputview/outputformats.cpp
M  +2    -4    outputview/outputformats.h
M  +1    -1    outputview/outputmodel.cpp
M  +0    -32   outputview/tests/test_filteringstrategy.cpp
M  +0    -2    outputview/tests/test_filteringstrategy.h

http://commits.kde.org/kdevplatform/596d64310d7a01ba24326c802e29b799443095f6
Comment 23 Kevin Funk 2016-10-07 08:57:54 UTC
*** Bug 330205 has been marked as a duplicate of this bug. ***