[CMake] CMake 3.5.0-rc1 crash (was: CMake 3.5.0-rc1 install is missing dependencies)

Brad King brad.king at kitware.com
Thu Feb 4 12:57:13 EST 2016


On 02/04/2016 11:00 AM, Thompson, KT wrote:
> #6 cmInstallCommand::InitialPass (this=0x1417360, args=std::vector of length 5, capacity 5 = {...}) at .../cmake-3.5.0-rc1/Source/cmInstallCommand.cxx:103 (at 0x000000000089ac4a)
> #5 cmInstallCommand::HandleExportMode (this=0x1417360, args=std::vector of length 5, capacity 5 = {...}) at .../cmake-3.5.0-rc1/Source/cmInstallCommand.cxx:1379 (at 0x00000000008a802a)
> #4 cmTarget::GetPolicyStatusCMP0022 (this=0x0) at .../cmake-3.5.0-rc1/Source/cmTarget.h:90 (at 0x00000000008c5636)
[snip]
> In cmInstallCommand.cxx, line 1376
> 
> cmTarget* tgt = this->Makefile->FindTarget(te->TargetName);
> 
> is setting tgt to a NULL pointer (0x0) that is dereferenced in the next line

Thanks!  From that I was able to narrow it to a simple test case:

------------------------------------------------------------------------------
$ cat CMakeLists.txt
cmake_minimum_required(VERSION 3.0)
project(Foo C)
add_subdirectory(A)
add_library(B SHARED empty.c)
install(TARGETS B DESTINATION lib EXPORT FooTargets)
install(EXPORT FooTargets DESTINATION lib/cmake/foo EXPORT_LINK_INTERFACE_LIBRARIES)

$ cat A/CMakeLists.txt
add_library(A SHARED ../empty.c)
install(TARGETS A DESTINATION lib EXPORT FooTargets)

$ mkdir b ; cd b
$ cmake --version
cmake version 3.5.0-rc1

$ cmake ..
...
Segmentation fault
------------------------------------------------------------------------------

This was likely caused by this change:

 cmExportSet: Store a cmGeneratorTarget.
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=381e7afd#patch6

Here is a fix and a test case:

 install(EXPORT): Fix crash on target in another directory
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=290fb8b9

I've queued this for merge to 'release' for inclusion in 3.5.0-rc2.

Thanks,
-Brad


More information about the CMake mailing list