Bug 330697 - KDevelop crashes when trying to parse CMake project with targets that depends on each other
Summary: KDevelop crashes when trying to parse CMake project with targets that depends...
Status: RESOLVED WORKSFORME
Alias: None
Product: kdevelop
Classification: Applications
Component: Build tools: CMake (show other bugs)
Version: git master
Platform: unspecified Linux
: HI crash
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords: regression, release_blocker
: 330755 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-02-03 11:43 UTC by Oleksandr Senkovych
Modified: 2014-07-04 09:16 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
New crash information added by DrKonqi (7.85 KB, text/plain)
2014-04-09 16:38 UTC, Nick Savoiu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oleksandr Senkovych 2014-02-03 11:43:35 UTC
If you for some reason create CMake project that has two targets and each one of them has other in dependencies, KDevelop crashes because of tons of recursive procesDependencies calls. 

An example CMakeLists.txt file that crashes KDevelop:

cmake_minimum_required(VERSION 2.8)
add_library(lib1 STATIC file1.cpp)
add_library(lib2 STATIC file2.cpp)
target_link_libraries(lib2 lib1)
target_link_libraries(lib1 lib2)
Comment 1 Kevin Funk 2014-02-03 13:35:57 UTC
Andras had the same problem. That needs to be fixed before release.
Comment 2 Milian Wolff 2014-02-04 15:46:20 UTC
*** Bug 330755 has been marked as a duplicate of this bug. ***
Comment 3 Kevin Funk 2014-02-11 10:09:24 UTC
Hack to make this work for the moment:

diff --git a/projectmanagers/cmake/cmakecommitchangesjob.cpp b/projectmanagers/cmake/cmakecommitchangesjob.cpp
index e7b9d4e..82abd2c 100644
--- a/projectmanagers/cmake/cmakecommitchangesjob.cpp
+++ b/projectmanagers/cmake/cmakecommitchangesjob.cpp
@@ -135,8 +135,8 @@ void processDependencies(ProcessedTarget &target, const QString& dep, const CMak
 
     target.includes += depData["INTERFACE_INCLUDE_DIRECTORIES"];
     target.defines += depData["INTERFACE_COMPILE_DEFINITIONS"];
-    foreach(const QString& d, depData["INTERFACE_LINK_LIBRARIES"])
-        processDependencies(target, d, data);
+//    foreach(const QString& d, depData["INTERFACE_LINK_LIBRARIES"])
+//        processDependencies(target, d, data);
 }

Raising importance, this makes KDevelop completely useless for some projects.
Comment 4 Milian Wolff 2014-02-11 10:46:58 UTC
A simple QSet recursion guard should be added to ensure we do not recurse into already handled dependencies to fix this. How hard can it beâ„¢
Comment 5 Nick Savoiu 2014-04-09 16:38:08 UTC
Created attachment 86018 [details]
New crash information added by DrKonqi

kdevelop (4.6.0) on KDE Platform 4.11.5 using Qt 4.8.5

- What I was doing when the application crashed:

I was just closing KDevelop after opening it and creating a dummy "hello world" c++ cmake project.

-- Backtrace (Reduced):
#7  0xa637430d in CMakeImportJob::initialize() () from /usr/lib/kde4/kdevcmakemanager.so
#8  0xa6374691 in QtConcurrent::VoidStoredMemberFunctionPointerCall0<void, CMakeImportJob>::runFunctor() () from /usr/lib/kde4/kdevcmakemanager.so
#9  0xa6374719 in QtConcurrent::RunFunctionTask<void>::run() () from /usr/lib/kde4/kdevcmakemanager.so
#10 0xb6432170 in QThreadPoolThread::run() () from /lib/libQtCore.so.4
#11 0xb643f380 in QThreadPrivate::start(void*) () from /lib/libQtCore.so.4
Comment 6 Milian Wolff 2014-07-04 09:16:38 UTC
This now works for me in current master / kdevelop 4.7 with the example provided above. Can someone still reproduce it with a recent checkout?