Bug 384487

Summary: CMake: Asserts when build directory is different from source directory
Product: [Applications] kdevelop Reporter: Kevin Funk <kfunk>
Component: Build tools: CMakeAssignee: kdevelop-bugs-null
Status: CONFIRMED ---    
Severity: normal CC: aleixpol
Priority: NOR    
Version First Reported In: git master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Kevin Funk 2017-09-08 10:58:06 UTC
Scenario:

I'd like to import:
  /home/kfunk/devel/src/llvm/tools/clang/tools/extra
The real top-level CMake source directory is:
  /home/kfunk/devel/src/llvm    
My build directory is: 
  /home/kfunk/devel/build/llvm 

As far as I understand importing the project this way actually works fine *in theory*. KDevelop build in release mode can open this; but sometimes hangs when importing the project. KDevelop built in debug mode crashes instantly.

Interesting log output:

kdevelop(31024)/kdevelop.projectmanagers.cmake: CMakeServer::handshake(174): Build directory is configured for another source directory: "CMAKE_HOME_DIRECTORY" "/home/kfunk/devel/src/llvm" wanted to open "/home/kfunk/devel/src/llvm/tools/clang/tools/extra" in "/home/kfunk/devel/build/llvm"
kdevelop(31024)/kdevelop.projectmanagers.cmake: CMakeServer::handshake(179): Using generator "Ninja" for project "/home/kfunk/devel/src/llvm/tools/clang/tools/extra" in "/home/kfunk/devel/build/llvm"
kdevelop(31024)/kdevelop.projectmanagers.cmake: CMakeServerImportJob::processResponse(193): unhandled message QJsonObject({"supportedProtocolVersions":[{"isExperimental":true,"major":1,"minor":0}],"type":"hello"})
kdevelop(31024)/kf5.kio.core: KIO::ConnectionBackend::socketReadyRead(321): KLocalSocket(0x2c36330) Jumbo packet of 530414 bytes
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
kdevelop(31024)/kf5.kio.core: KIO::ConnectionBackend::socketReadyRead(321): KLocalSocket(0x2c36330) Jumbo packet of 530414 bytes
kdevelop(31024)/kdevelop.projectmanagers.cmake: CMakeServer::CMakeServer(QObject *)::(anonymous class)::operator()(61): cmake server error: QProcess::ProcessError(Crashed) "/home/kfunk/.cache/kdevelop/kdevelopcmake.r31024" "" ""
kdevelop(31024)/kdevplatform.shell: IdentityRuntime::startProcess(QProcess *)::(anonymous class)::operator()(45): error: QProcess::ProcessError(Crashed) "/usr/bin/cmake" "Process crashed"
kdevelop(31024)/kdevelop.projectmanagers.cmake: CMakeServer::CMakeServer(QObject *)::(anonymous class)::operator()(64): cmake server finished with code 6
kdevelop(31024)/default: unknown(172): ASSERT: "!server->isServerAvailable()" in file /home/kfunk/devel/src/kf5/kdevelop/projectmanagers/cmake/cmakemanager.cpp, line 172

That assert should be relaxed one way or the other.