View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013935CMakeCMakepublic2013-02-19 13:032014-09-03 10:55
ReporterRick Ballard 
Assigned ToBrad King 
PriorityhighSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformAppleOSOS XOS Version10.8.2
Product VersionCMake 2.8.10.2 
Target VersionCMake 2.8.11Fixed in VersionCMake 2.8.11 
Summary0013935: CMake generates corrupt Xcode project files due to illegal reuse of target dependencies
DescriptionCMake generates corrupt Xcode project files which will cause Xcode to crash in certain circumstances.

In an Xcode project file, every time a target depends on another target there should be a unique PBXTargetDependency object in the project file representing that dependency. Even if multiple targets depend on the same other target, they should each have their own instance of a PBXTargetDependency representing that relationship to the other target. Unfortunately, CMake reuses a PBXTargetDependency object when multiple targets depend on the same other target. This will cause Xcode to crash if the user tries to delete that target dependency in Xcode's target editor UI. It may cause other problems as well, though I haven't looked into it enough to know.

Please fix CMake so that it generates a unique PBXTargetDependency in the project file for every instance of a target dependency.
Steps To Reproduce1. Install cmake from http://www.cmake.org/files/v2.8/cmake-2.8.10.2-Darwin64-universal.dmg [^]
2. Download and unzip the attached sample folder that is attached.
3. Create a folder named xcodebuild inside the sample folder
4. Open a terminal and do "cd sample/xcodebuild"
5. Run the command "cmake -G Xcode .."

At this point if you inspect the text of the generated Xcode project named "HELLO", you will see that there are PBXTargetDependency objects in this file that are referenced by multiple targets. This is a bug; each PBXTargetDependency is allowed to be owned by one and only one target.

To demonstrate a crash in Xcode that this causes:

6. Open the Xcode project named HELLO that is created inside the xcodebuild folder
7. Select the Hello target, choose "Build Phases"
8. Open "Target Dependency" build phase
9. Select "ZERO_CHECK (HELLO)" dependency
10. Click "-" to remove the selected dependency
11. Wait for Xcode to crash.
Additional InformationApple has received a lot of crash reports from users hitting this crash. While it is a bug that corrupt project files cause Xcode to crash instead of displaying an error, we'd appreciate it if CMake would generate correct project files.
TagsNo tags attached.
Attached Fileszip file icon sample.zip [^] (2,215 bytes) 2013-02-19 13:03

 Relationships
related to 0015111closedBrad King “File reference” warnings when building a CMake project with Xcode 6 

  Notes
(0032344)
Brad King (manager)
2013-02-19 15:40

Is there any documentation of Xcode's format or the object model it serializes?

CMake's generator was written by creating projects by hand in the IDE and reading the pbxproj files produced.
(0032345)
Rick Ballard (reporter)
2013-02-19 16:01

There is no documentation of the format; we don't officially support generating Xcode project files. But if you look at the project files Xcode generates, you'll notice that Xcode never re-uses PBXTargetDependency objects for multiple targets the way CMake is doing.
(0032346)
Brad King (manager)
2013-02-19 16:17

Does the associated PBXContainerItemProxy need to be duplicated for each dependency graph edge too or can that be shared as it is now?
(0032347)
Rick Ballard (reporter)
2013-02-19 16:24

Yes; each PBXTargetDependency should have a unique PBXContainerItemProxy as its targetProxy.
(0032349)
Brad King (manager)
2013-02-19 17:08

Thanks for tracking it down this far and providing the detailed report.

Ironically the current CMake implementation goes out of its way to avoid duplicating the PBXTargetDependency objects.

After some cleanup:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=781ea6d1 [^]

I've committed a fix:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b0051404 [^]
(0033431)
Robert Maynard (manager)
2013-07-01 09:38

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

 Issue History
Date Modified Username Field Change
2013-02-19 13:03 Rick Ballard New Issue
2013-02-19 13:03 Rick Ballard File Added: sample.zip
2013-02-19 15:40 Brad King Note Added: 0032344
2013-02-19 16:01 Rick Ballard Note Added: 0032345
2013-02-19 16:17 Brad King Note Added: 0032346
2013-02-19 16:24 Rick Ballard Note Added: 0032347
2013-02-19 17:08 Brad King Note Added: 0032349
2013-02-19 17:08 Brad King Assigned To => Brad King
2013-02-19 17:08 Brad King Status new => resolved
2013-02-19 17:08 Brad King Resolution open => fixed
2013-02-19 17:08 Brad King Fixed in Version => CMake 2.8.11
2013-02-19 17:08 Brad King Target Version => CMake 2.8.11
2013-07-01 09:38 Robert Maynard Note Added: 0033431
2013-07-01 09:38 Robert Maynard Status resolved => closed
2014-09-03 10:55 Brad King Relationship added related to 0015111


Copyright © 2000 - 2018 MantisBT Team