Bug 309402

Summary: (Regression) kdevelop runs cmake before every build
Product: [Applications] kdevelop Reporter: Matthew Woehlke <mwoehlke.floss>
Component: Build tools: CMakeAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: aleixpol, rdieter
Priority: NOR    
Version First Reported In: 4.4.0   
Target Milestone: 4.3.0   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: project demonstrating the problem

Description Matthew Woehlke 2012-11-02 00:36:37 UTC
KDevelop 4.4 appears to find it necessary to reconfigure every project in the build set before building it (at least with CMake; didn't test with other build systems). This is unnecessary with CMake, as CMake generates rules to automatically reconfigure as part of the build when necessary.

This can significantly slow down builds, especially when working on a build chain involving multiple projects where one or more take a long time to configure. If the decision to reconfigure is left to the build system, rather than forced, "rebuilding" unchanged projects can happen in a fraction of a second.

This appears to be a regression from 4.3.0, and may also be making KDevelop more crash-prone (i.e. bug 305860).

Reproducible: Always

Steps to Reproduce:
1. Open a CMake project.
2. Build the project.
3. Build the project again.
Actual Results:  
On second build, project is reconfigured, even though nothing has changed.

Expected Results:  
On second build, returns immediately with 'nothing to do'.
Comment 1 Aleix Pol 2012-11-20 00:50:09 UTC
I can't really reproduce this problem here. Can you please provide more information?

Maybe you can try and see if it happens with a simple cmake project too? I don't really know what can be going on, I tried with both make and ninja and both work as expected.

Please re-open when more information is available!
Comment 2 Kevin Funk 2012-11-20 10:48:17 UTC
Also try if running 'make' via shell tries to re-run cmake as well. (This may be caused by a malicious CMakeListst.txt)
Comment 3 Matthew Woehlke 2012-11-20 16:07:14 UTC
Hmm... I can definitely reproduce for *some* sessions... others it's hard to say; maybe not, or maybe that the configure step runs too quickly to notice. It doesn't happen when I run 'ninja' from the command line. (Moreover, it is DEFINITELY kdevelop doing something; it runs configure as a separate step from build, as demonstrated in that it clears the build output between steps.)
Comment 4 Matthew Woehlke 2012-11-20 16:16:14 UTC
Created attachment 75381 [details]
project demonstrating the problem

Here is a very simple project that demonstrates the problem.

When I right-click the project in the build step and 'Build', I see:
/home/matthew/foo/kdev-test/build> /usr/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=RelWithDebInfo -G Ninja /home/matthew/foo/kdev-test/

...followed by lots and lots of output. After this completes, the build output clears and then shows:

/home/matthew/foo/kdev-test/build> ninja -j10
ninja: no work to do.
*** Finished ***
Comment 5 Matthew Woehlke 2012-11-20 16:53:06 UTC
So... I can't reproduce with KDevelop master. Either it is fixed since 4.4.1, or Fedora managed to muck up their packages somehow.

I'm going to re-file this as a Fedora bug.
Comment 6 Matthew Woehlke 2012-11-21 23:00:22 UTC
For the record, I've determined that this was introduced by commit af2e77a4237b2348c59ab025389319caf085deb0b, and fixed by commits 8723751a938c95d48a80a456ef9d903f988b68f3 and 2bd8cfdbf78028e016106f192656924b026d55f6.

It *is* broken on origin/4.4 (which has the first commit but not the second two), but fixed on origin/master.
Comment 7 Aleix Pol 2012-11-22 02:29:46 UTC
Interesting... my bad! >.<

Ok, I've cherry-picked those to 4.4. Big thanks for investigating!!! :)