View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015626CMakeCMakepublic2015-06-23 13:492016-02-01 09:10
ReporterAndrew Fuller 
Assigned ToBrad King 
PriorityhighSeveritycrashReproducibilityalways
StatusclosedResolutionfixed 
PlatformLinuxOSUbuntuOS Version14.04
Product Version 
Target VersionCMake 3.3Fixed in VersionCMake 3.3 
Summary0015626: 3.3-rc2 segfault (regression)
DescriptionManipulating a target that was first created in a different directory branch causes a segfault.
Steps To Reproduce1. Create the following CMake files:

$ tree
.
├── CMakeLists.txt
├── dirA
│   └── CMakeLists.txt
└── dirB
    └── CMakeLists.txt

$ cat CMakeLists.txt

add_subdirectory( dirA )
add_subdirectory( dirB )

$ cat dirA/CMakeLists.txt

add_library( foo INTERFACE )

$ cat dirB/CMakeLists.txt

target_link_libraries( foo INTERFACE ${CMAKE_DL_LIBS} )

2. Configure
$ mkdir build && cd build && cmake ..
[...]
[1] 6691 segmentation fault (core dumped) cmake ..
Additional InformationThis works fine with CMake 3.2.1.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0038962)
Brad King (manager)
2015-06-23 14:50

Thanks. This bisects to:

 cmTarget: Store only cmListFileContext for CMP0023 handling.
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=52a8d19c [^]
(0038984)
Brad King (manager)
2015-06-25 11:00

Fixed and test case added:

 cmTarget: Fix diagnostic of target_link_libraries in wrong directory
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=30c2e1dd [^]

I've queued this for merge to 'release' for 3.3.0-rc3.
(0038985)
Andrew Fuller (reporter)
2015-06-25 11:15

If I'm reading the commit correctly, the fix is to report an error (better than crashing). Is there a CMP I can set to have the old behaviour? Or is there something I can test to determine whether it's safe to modify the target? In my current code I'm checking if( TARGET foo ), but that's only testing whether the target has been declared which no longer aligns with can-I-poke-it.
(0038986)
Brad King (manager)
2015-06-25 11:54

Re 0015626:0038985: There is no behavior change from CMake 3.2. Using target_link_libraries to add INTERFACE settings from another directory is still allowed. Using target_link_libraries to actually change how a target itself links was never allowed and still is not. Both cases excercise the code path that caused this crash. I just chose the latter for the test case.
(0038987)
Andrew Fuller (reporter)
2015-06-25 12:13

Wonderful. I just tried it and it's working well.
(0040400)
Robert Maynard (manager)
2016-02-01 09:10

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-06-23 13:49 Andrew Fuller New Issue
2015-06-23 14:50 Brad King Note Added: 0038962
2015-06-23 14:50 Brad King Assigned To => Stephen Kelly
2015-06-23 14:50 Brad King Status new => assigned
2015-06-23 14:50 Brad King Target Version => CMake 3.3
2015-06-25 11:00 Brad King Note Added: 0038984
2015-06-25 11:00 Brad King Assigned To Stephen Kelly => Brad King
2015-06-25 11:00 Brad King Status assigned => resolved
2015-06-25 11:00 Brad King Resolution open => fixed
2015-06-25 11:00 Brad King Fixed in Version => CMake 3.3
2015-06-25 11:15 Andrew Fuller Note Added: 0038985
2015-06-25 11:54 Brad King Note Added: 0038986
2015-06-25 12:13 Andrew Fuller Note Added: 0038987
2016-02-01 09:10 Robert Maynard Note Added: 0040400
2016-02-01 09:10 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team