fastlane: codesigning fails with "unknown error -1=ffffffffffffffff"

New Issue Checklist

Issue Description

I’m in the process of setting up fastlane on our CI box as a replacement of the (currently broken) Xcodebuild plugin for Jenkins. Everything works fine until the last step, codesigning, which fails with “unknown error -1=ffffffffffffffff”.

Last output from fastlane is

▸ Running script '[CP] Embed Pods Frameworks'
** ARCHIVE FAILED **


The following build commands failed:
PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/ci/Library/Developer/Xcode/DerivedData/Sellfio2-bcmcyzbzidlxvfbqydgqbpurglpe/Build/Intermediates/ArchiveIntermediates/Sellfio2/IntermediateBuildFilesPath/Sellfio2.build/Release-iphoneos/Sellfio2.build/Script-0C0A451C95B1AB212FE0C0F6.sh
(1 failure)
[13:33:57]: Exit status: 65
[13:33:57]: 📋  For a more detailed error log, check the full log at:
[13:33:57]: 📋  /Users/ci/Library/Logs/gym/Sellfio2-Sellfio2.log

and the last lines of that file are

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/ci/Library/Developer/Xcode/DerivedData/Sellfio2-bcmcyzbzidlxvfbqydgqbpurglpe/Build/Intermediates/ArchiveIntermediates/Sellfio2/IntermediateBuildFilesPath/Sellfio2.build/Release-iphoneos/Sellfio2.build/Script-0C0A451C95B1AB212FE0C0F6.sh
    cd /Users/ci/fastlane-test/sellfio2/ios/Sellfio2
    /bin/sh -c /Users/ci/Library/Developer/Xcode/DerivedData/Sellfio2-bcmcyzbzidlxvfbqydgqbpurglpe/Build/Intermediates/ArchiveIntermediates/Sellfio2/IntermediateBuildFilesPath/Sellfio2.build/Release-iphoneos/Sellfio2.build/Script-0C0A451C95B1AB212FE0C0F6.sh
mkdir -p /Users/ci/Library/Developer/Xcode/DerivedData/Sellfio2-bcmcyzbzidlxvfbqydgqbpurglpe/Build/Intermediates/ArchiveIntermediates/Sellfio2/BuildProductsPath/Release-iphoneos/Sellfio2.app/Frameworks
Symlinked...
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "/Users/ci/Library/Developer/Xcode/DerivedData/Sellfio2-bcmcyzbzidlxvfbqydgqbpurglpe/Build/Intermediates/ArchiveIntermediates/Sellfio2/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Alamofire.framework" "/Users/ci/Library/Developer/Xcode/DerivedData/Sellfio2-bcmcyzbzidlxvfbqydgqbpurglpe/Build/Intermediates/ArchiveIntermediates/Sellfio2/InstallationBuildProductsLocation/Applications/Sellfio2.app/Frameworks"
building file list ... done
Alamofire.framework/
Alamofire.framework/Alamofire
Alamofire.framework/Info.plist

sent 8267979 bytes  received 70 bytes  16536098.00 bytes/sec
total size is 8266736  speedup is 1.00
Code Signing /Users/ci/Library/Developer/Xcode/DerivedData/Sellfio2-bcmcyzbzidlxvfbqydgqbpurglpe/Build/Intermediates/ArchiveIntermediates/Sellfio2/InstallationBuildProductsLocation/Applications/Sellfio2.app/Frameworks/Alamofire.framework with Identity iPhone Developer: Continuous Integration (....)
/usr/bin/codesign --force --sign CB4821C55BE587CB4FBC45586BB528E192FF4575  --preserve-metadata=identifier,entitlements '/Users/ci/Library/Developer/Xcode/DerivedData/Sellfio2-bcmcyzbzidlxvfbqydgqbpurglpe/Build/Intermediates/ArchiveIntermediates/Sellfio2/InstallationBuildProductsLocation/Applications/Sellfio2.app/Frameworks/Alamofire.framework'
/Users/ci/Library/Developer/Xcode/DerivedData/Sellfio2-bcmcyzbzidlxvfbqydgqbpurglpe/Build/Intermediates/ArchiveIntermediates/Sellfio2/InstallationBuildProductsLocation/Applications/Sellfio2.app/Frameworks/Alamofire.framework: unknown error -1=ffffffffffffffff
Command /bin/sh failed with exit code 1

This only happens on our CI box (running macOS 10.12.4 and Xcode 8.3. fastlane and cocoapods are up-to-date)

Environment

Please run fastlane env and copy the output below. This will help us help you 👍 If you used --capture_output option please remove this block - as it is already included there.

[INSERT OUTPUT HERE]

Stack

Key Value
OS 10.12.4
Ruby 2.4.1
Bundler? true
Git git version 2.11.0 (Apple Git-81)
Installation Source /usr/local/bin/fastlane
Host Mac OS X 10.12.4 (16E195)
Ruby Lib Dir /usr/local/Cellar/ruby/2.4.1_1/lib
OpenSSL Version OpenSSL 1.0.2k 26 Jan 2017
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode.app/Contents/Developer/
Xcode Version 8.3

System Locale

Variable Value
LANG
LC_ALL en_US.UTF-8
LANGUAGE

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 3
  • Comments: 22 (3 by maintainers)

Most upvoted comments

After setting up a new box from scratch and running into the exact same problem there, I was finally able to resolve this using the 2nd answer from this SO question.

Basically, in addition to unlocking the keychain it is also necessary to run security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k keychainPass keychainName

I fixed it using advice from Apple forums.

I removed /Users/Shared/Jenkins/Library/Developer/Xcode/DerivedData/MyApp_Mobile-dgutwijgjsaamffoginrqioxpmvb

Yip yip!

One more helpful hint: the security command seems not to like relative paths. If you’re using keychain files, rather than, say, the standard login.keychain, give it a full path starting with /.