1
votes

My project uses Carthage and builds successfully locally, but when I try to build it with an Azure DevOps pipeline on a Microsoft Hosted Agent I get this error:

The following build commands failed:

PhaseScriptExecution Carthage\ Copy\ Frameworks /Users/runner/Library/Developer/Xcode/DerivedData/My-Scheme-euhffgcbmkrrcmfffhaqpabtlubp/Build/Intermediates.noindex/My-Scheme.build/Release-iphoneos/My-Scheme.build/Script-DB5433C1239AF75F00C0B252.sh (1 failure)

[error] Error: /usr/bin/xcodebuild failed with return code: 65

This is my Carthage Copy Frameworks Build Phase:

/usr/local/bin/carthage copy-frameworks

My guess is that something is different about the configuration of the Azure machine but I don't know what or how to fix it.

I'm also getting this error:

❌ fatal error: /Applications/Xcode_10.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: Input file: /Users/runner/Library/Developer/Xcode/DerivedData/My-Scheme-euhffgcbmkrrcmfffhaqpabtlubp/Build/Products/Release-iphoneos/Realm.framework.dSYM/Contents/Resources/DWARF/Realm changed since opened (Undefined error: 0)

1
Could you have a try setting the sdk and xcodeVersion of the xcode task in azure pipeline the same as you local machine?Levi Lu-MSFT

1 Answers

0
votes

Even if Carthage causes no problems locally, if your scheme builds multiple targets that run the carthage copy-frameworks command, the agent machine may throw an error like the one above: Realm changed since opened (Undefined error: 0).

It seems that the same files are being accessed simultaneously because multiple targets are being built in parallel. In my case, carthage copy-frameworks was being run for my app target and my test target. A fix for this is to have your scheme only build the app target:

Product > Scheme > Edit Scheme > Build (n targets) > Target to Remove > Select -