Upgrade from xCode 14.2 to 14.3 PhaseScriptExecution failed with a nonzero exit code

Hello,

I've upgraded from xcode 14.2 to xcode 14.3 beta, and now I can't archive anymore for Any iOS Device (arm64) with the following error :

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks

mkdir -p /Users/max/Library/Developer/Xcode/DerivedData/Max-dmwafkgdrzqavzcmbdjbjgmmuxby/Build/Intermediates.noindex/ArchiveIntermediates/Release_preprod/BuildProductsPath/Release_preprod-iphoneos/MaxApp.app/Frameworks

Symlinked...

rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/ActionSheetPicker_3_0.framework" "/Users/max/Library/Developer/Xcode/DerivedData/Max-dmwafkgdrzqavzcmbdjbjgmmuxby/Build/Intermediates.noindex/ArchiveIntermediates/Release_preprod/InstallationBuildProductsLocation/Applications/MaxApp.app/Frameworks"

building file list ... rsync: link_stat "/Users/max/Workspace/MaxApp/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/ActionSheetPicker_3_0.framework" failed: No such file or directory (2)

done



sent 29 bytes  received 20 bytes  98.00 bytes/sec

total size is 0  speedup is 0.00

rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/9e200cfa-7d96-11ed-886f-a23c4f261b56/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]

Command PhaseScriptExecution failed with a nonzero exit code

Any idea why it works fine with xCode 14.2 and not with xCode 14.3 beta please ?

I tryed to delete the [CP] Embed Pods Frameworks script, but it has re-created it and get the same issue.

I tryed to build and debug in a simulator, and it works fine.

I tryed to delete "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; in the .pbxproj file

Answered by vadimwe in 749297022

Workaround is to update all the generated ...-frameworks.sh files to add the -f flag to the call to readlink. In other words, need to replace:

source="$(readlink "${source}")"

with

source="$(readlink -f "${source}")"

Seems this is CocoaPods issue...

Thanks @vadimwe! Life saver and time saver! worked for me too... I am a newbie to developing, but will we need to change it back to source="$(readlink "${source}")" at a later update to xcode? What does the code change do out of curiosity ? Thanks again for your help!

Solution by @vadimwe worked for me! 👍 in APPNAME/ios/App/Pods/Target Support Files/Pods-App/Pods-App-frameworks.sh replaced source="$(readlink "${source}")" with source="$(readlink -f "${source}")"

you don't need to build the code again after you change . Make the change in VS code and then go straight to xcoud > Product > Archive

how to fix the same with fastlane builds?

Was facing the same issue. @vadimwe Thanks a lot for the solution. Is there any way to apply this fix on the cloud build?

Faced the same issue. @vadimwe reply worked for me. Thanks a lot for the solution @vadimwe.

Thanks alot @vadimwe, your solution worked for me.

Finally to avoid this issue please update cocoapods to latest version.

gem install cocoapods --user-install

Worked for me, thanks @vadimwe

Solution by @vadimwe worked for me.

Updating to Cocoapods v1.12.1 resolved this for me.

Had the same issue. Solution by @vadimwe worked for me. Thanks !

Thx @vadimwe ... you helped me out here ;)

@vadimwe 's answer is correct, and I updated my Podfile like this to edit automatically when you run pod install .

post_install do |installer|
  command = <<~EOS
    find . -name *frameworks.sh | tr \\n \\0 |  xargs -0 sed -i -e 's/source="$(readlink "${source}")"/source="$(readlink -f "${source}")"/'
  EOS
  system(command)
end

Yes, this is the solution for now! If anyone is interested, I'm posting the code I put into my node build script AFTER running the 'pod install':

async function replaceInFiles(targetPath, before, after) {
	var command = `unset LANG; find . -type f -name '*' -print0 |xargs -0 sed -i '' 's/${before}/${after}/g'`
	await shell(command, {"cwd": targetPath})
}
.
.
.
//HACK: fix bug in pods installer
			var oldText = "readlink \"${source}\""
			var newText = "readlink -f \"${source}\""
			console.log(`BUG FIX: changing ${oldText} to ${newText} in ${brandTargetFolder}...`)
			await replaceInFiles(`${brandTargetFolder}/platforms/ios/Pods/Target Support Files/Pods-${brand}`, oldText, newText)


Upgrade from xCode 14.2 to 14.3 PhaseScriptExecution failed with a nonzero exit code
 
 
Q