Hi,
I am having a problem with CI builds when building Unity3d projects. The pipeline first builds the project using Unity which results in a Xcode project. Our pipeline then uses `xcodebuild` in two phases. In first phase it builds the project with archive action. Second phase exports the archive into an application package using `-exportArchive`. The problem I have is with archive action after updating Unity from 5.3.x to 5.4.0. The reason I ask here instead Unity3d forums is that we do native builds also. If this starts to happen with them, I need to be able to fix whatever is causing this issue. CI machine in question has OSX 10.11.4 and Xcode 7.3.1. Here is an excerpt from `xcodebuild` output.
$ xcodebuild archive -project Unity-iPhone.xcodeproj -configuration Release -scheme Unity-iPhone -archivePath /JenkinsHDD/workspace/<redacted>/path/to/project/<redacted>.xcarchive DEPLOYMENT_POSTPROCESSING=YES CODE_SIGN_IDENTITY=<redacted> ENABLE_BITCODE=NO PROVISIONING_PROFILE=<redacted> SHARED_PRECOMPS_DIR=/JenkinsHDD/workspace/<redacted>/client/build/unity/ios/release
/* snip */
Strip /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/InstallationBuildProductsLocation/Applications/<redacted>.app/<redacted>
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/InstallationBuildProductsLocation/Applications/<redacted>.app/<redacted>
SetOwnerAndGroup <redacted>:staff /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/InstallationBuildProductsLocation/Applications/<redacted>.app
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/usr/sbin/chown -RH <redacted>:staff /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/InstallationBuildProductsLocation/Applications/<redacted>.app
SetMode u+w,go-w,a+rX /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/InstallationBuildProductsLocation/Applications/<redacted>.app
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/bin/chmod -RH u+w,go-w,a+rX /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/InstallationBuildProductsLocation/Applications/<redacted>.app
ProcessProductPackaging /Users/<redacted>/Library/MobileDevice/Provisioning\ Profiles/<redacted>.mobileprovision /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/InstallationBuildProductsLocation/Applications/<redacted>.app/embedded.mobileprovision
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
builtin-productPackagingUtility /Users/<redacted>/Library/MobileDevice/Provisioning\ Profiles/<redacted>.mobileprovision -o /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/InstallationBuildProductsLocation/Applications/<redacted>.app/embedded.mobileprovision
Touch /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/InstallationBuildProductsLocation/Applications/<redacted>.app
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/usr/bin/touch -c /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/InstallationBuildProductsLocation/Applications/<redacted>.app
ProcessProductPackaging /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/Entitlements.plist /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/<redacted>.app.xcent
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
builtin-productPackagingUtility /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/Entitlements.plist -entitlements -format xml -o /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/<redacted>.app.xcent
CodeSign /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/InstallationBuildProductsLocation/Applications/<redacted>.app
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
Signing Identity: "<redacted>"
Provisioning Profile: "<redacted>"
(<redacted>)
/usr/bin/codesign --force --sign <redacted> --entitlements /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/<redacted>.app.xcent --timestamp=none /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/InstallationBuildProductsLocation/Applications/<redacted>.app
Validate /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/InstallationBuildProductsLocation/Applications/<redacted>.app
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export PRODUCT_TYPE=com.apple.product-type.application
builtin-validationUtility /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/InstallationBuildProductsLocation/Applications/<redacted>.app
Touch /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/BuildProductsPath/Release-iphoneos/<redacted>.app.dSYM
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/usr/bin/touch -c /Users/<redacted>/Library/Developer/Xcode/DerivedData/Unity-iPhone-fynvgzmjcsmtykcpkjmoxnkzzhqd/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/BuildProductsPath/Release-iphoneos/<redacted>.app.dSYM
** ARCHIVE FAILED **
$ echo $?
65
This only seems to be reproduceable on our CI machines. I have tried checking out the usual suspects, such as invalid or expired certificates or provisioning profiles. All certificates are valid, keychains are properly unlocked during the build and I see no issues with the provisioning profiles. Also, whenever there is a codesigning issue, `xcodebuild` usually fails immediately after call to /usr/bin/codesign or even much earlier if no codesign identities are found. Information I found by googling does not help much. Closest I found was this stackoverflow question https://stackoverflow.com/questions/28794243/xcode-build-fails-with-error-code-65-without-indicative-message. However, I am skeptical why CopyPNG step would suddently start failing the build, since while we do have CopyPNG fails in the log, those have been around for quite some time. Also, turning on -verbose flag did not reveal any more information.
Can anybody point me in the right direction how to figure out this issue?