[cmake-developers] [CMake 0011844]: Xcode universal binary build interacts badly with Xcode depends helper

Mantis Bug Tracker mantis at public.kitware.com
Fri Feb 11 05:14:28 EST 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=11844 
====================================================================== 
Reported By:                Matthew Bentham
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   11844
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-02-11 05:14 EST
Last Modified:              2011-02-11 05:14 EST
====================================================================== 
Summary:                    Xcode universal binary build interacts badly with
Xcode depends helper
Description: 
CMake Xcode projects contain rules to delete out-of-date files during the build.

When building more than one architecture, the rules are incorrect and, depending
on timing and number of Xcode processes, delete up-to-date files as well, which
causes build failures as Xcode tries to use them as inputs into later build
stages.

Xcode reports errors similar to this:

CreateUniversalBinary Debug/prog4 normal "i386 x86_64"
cd /Users/mjb67local/Documents/foo/xcode-depends-bug
/usr/bin/lipo -create
/Users/mjb67local/Documents/foo/xcode-depends-bug/test_xcode_depends.build/Debug/prog4.build/Objects-normal/i386/prog4
/Users/mjb67local/Documents/foo/xcode-depends-bug/test_xcode_depends.build/Debug/prog4.build/Objects-normal/x86_64/prog4
-output /Users/mjb67local/Documents/foo/xcode-depends-bug/Debug/prog4

/usr/bin/lipo: can't open input file:
/Users/mjb67local/Documents/foo/xcode-depends-bug/test_xcode_depends.build/Debug/prog4.build/Objects-normal/i386/prog4
(No such file or directory)
Command /usr/bin/lipo failed with exit code 1

It seems that the XCODE_DEPENDS_HELPER.make script contains rules like this:


/Users/mjb67local/Documents/foo/xcode-depends-bug/RelWithDebInfo/prog4:
	/bin/rm -f
/Users/mjb67local/Documents/foo/xcode-depends-bug/RelWithDebInfo/prog4
	/bin/rm -f
/Users/mjb67local/Documents/foo/xcode-depends-bug/test_xcode_depends.build/RelWithDebInfo/prog4.build/Objects-normal/i386/prog4
	/bin/rm -f
/Users/mjb67local/Documents/foo/xcode-depends-bug/test_xcode_depends.build/RelWithDebInfo/prog4.build/Objects-normal/x86_64/prog4

Which will delete both architecture-specific files during an Xcode IDE build (or
an xcodebuild -parllelizeTargets build) if lipo has not yet written to the
universal binary file.

Steps to Reproduce: 
This CMakeLists file:

cmake_minimum_required(VERSION 2.8)
project("test_xcode_depends")
set(CMAKE_OSX_ARCHITECTURES "i386;x86_64")
add_executable("prog1" foo1.c)
add_executable("prog2" foo1.c)
add_executable("prog3" foo1.c)
add_executable("prog4" foo1.c)
add_executable("prog5" foo1.c)
add_executable("prog6" foo1.c)

With commands:

cmake -G Xcode
cmake --build . --clean-first -- -parallelizeTargets

Will produce the error pretty reliably. On machines with lots of cores a larger
number of  independent targets might be necessary.  Basically the error occurs
when the post-build steps of one of the targets gets run during the compilation
steps of one of the other targets.

Additional Information: 
I suspect it would be fixed if XCODE_DEPENDS_HELPER.make looked something like
this instead:

xcode-depends-bug/RelWithDebInfo/prog4:
xcode-depends-bug/test_xcode_depends.build/RelWithDebInfo/prog4.build/Objects-normal/i386/prog4
xcode-depends-bug/test_xcode_depends.build/RelWithDebInfo/prog4.build/Objects-normal/x86_64/prog4
	/bin/rm -f xcode-depends-bug/RelWithDebInfo/prog4

xcode-depends-bug/test_xcode_depends.build/RelWithDebInfo/prog4.build/Objects-normal/i386/prog4:
	/bin/rm -f
xcode-depends-bug/test_xcode_depends.build/RelWithDebInfo/prog4.build/Objects-normal/i386/prog4

xcode-depends-bug/test_xcode_depends.build/RelWithDebInfo/prog4.build/Objects-normal/x86_64/prog4:
	/bin/rm -f
xcode-depends-bug/test_xcode_depends.build/RelWithDebInfo/prog4.build/Objects-normal/x86_64/prog4
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-02-11 05:14 Matthew BenthamNew Issue                                    
2011-02-11 05:14 Matthew BenthamFile Added: xcode-depends-bug.zip               
    
======================================================================




More information about the cmake-developers mailing list