capacitor icon indicating copy to clipboard operation
capacitor copied to clipboard

bug: Xcode build fails with Command PhaseScriptExecution failed with a nonzero exit code

Open ryaa opened this issue 3 years ago • 16 comments

Bug Report

Capacitor Version

Latest Dependencies:

  @capacitor/cli: 4.7.3
  @capacitor/core: 4.7.3
  @capacitor/android: 4.7.3
  @capacitor/ios: 4.7.3

Installed Dependencies:

  @capacitor/cli: 4.4.0
  @capacitor/core: 4.4.0
  @capacitor/android: 4.4.0
  @capacitor/ios: 4.4.0

Platform(s)

MacOS Ventura 13.3 with XCode 14.3

Current Behavior

When trying to create new archive using XCode the build fails with the below error

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/alexryltsov/Library/Developer/Xcode/DerivedData/App-gxagovealdxcbabobtkbwqhuaflv/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script-2FC07ECF8E24DE592E110C7C.sh (in target 'App' from project 'App')
    cd /Users/alexryltsov/Git/BOSS811-MOBILE/release-build-3.0.12/ios/App
    /bin/sh -c /Users/alexryltsov/Library/Developer/Xcode/DerivedData/App-gxagovealdxcbabobtkbwqhuaflv/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script-2FC07ECF8E24DE592E110C7C.sh

mkdir -p /Users/alexryltsov/Library/Developer/Xcode/DerivedData/App-gxagovealdxcbabobtkbwqhuaflv/Build/Intermediates.noindex/ArchiveIntermediates/App/BuildProductsPath/Release-iphoneos/App.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/Capacitor.framework" "/Users/alexryltsov/Library/Developer/Xcode/DerivedData/App-gxagovealdxcbabobtkbwqhuaflv/Build/Intermediates.noindex/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/App.app/Frameworks"
building file list ... rsync: link_stat "/Users/alexryltsov/Git/BOSS811-MOBILE/release-build-3.0.12/ios/App/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Capacitor.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/97f6331a-ba75-11ed-a4bc-863efbbaf80d/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]
Command PhaseScriptExecution failed with a nonzero exit code

Expected Behavior

No error and the build completes successfully

Code Reproduction

The problem started to appear for all iOS native projects after XCode has been upgraded to the latest version 14.3

Other Technical Details

npm --version output: 9.6.1

node --version output: v18.12.0

pod --version output (iOS issues only): 1.12.0

Additional Context

ryaa avatar Apr 03 '23 09:04 ryaa

The problem seems to be caused by this issue and should be fixed in the next CocoaPods release.

The workaround that helps to resolve the problem is discussed here. For Capacitor iOS project the below line in the single file needs to be changed and should look as below Screenshot 2023-04-03 at 11 18 07 AM

OR wait for the cocoapods new release and follow these steps https://github.com/CocoaPods/CocoaPods/issues/11808#issuecomment-1493930311

ryaa avatar Apr 03 '23 09:04 ryaa

Here is the related ticket https://github.com/ionic-team/capacitor/issues/6454

ryaa avatar Apr 04 '23 05:04 ryaa

Thanks 👍 @ryaa

sawaca96 avatar Apr 04 '23 13:04 sawaca96

Here is the Cocoapods issue for those interested: https://github.com/CocoaPods/CocoaPods/issues/11808

markemer avatar Apr 04 '23 16:04 markemer

Here is their merged pull request: https://github.com/CocoaPods/CocoaPods/pull/11828 so now we're just waiting for the release of 1.12.1

markemer avatar Apr 04 '23 16:04 markemer

Thank you @ryaa for opening this issue, it was a lifesaver. Your screenshot was a bit unclear to me. To get it to work for me, line 44 needed to be:

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

(no space between the dash and f, and no pipe after it).

wingedpig avatar Apr 07 '23 16:04 wingedpig

(no space between the dash and f, and no pipe after it).

The pipe is the cursor :) and yes, there should be no space, right....

ryaa avatar Apr 07 '23 17:04 ryaa

This solution worked for me to get a successful archive and was a lot less intrusive than downgrading xcode or having to manually update a bunch of files one-by-one: https://github.com/CocoaPods/CocoaPods/issues/11808#issuecomment-1496996057

roundlakedan avatar Apr 09 '23 14:04 roundlakedan

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

This helped me also. Life saver guys  ☺️

typefox09 avatar Apr 10 '23 12:04 typefox09

CocoaPods 1.12.0 -> 1.12.1 It has been shipped!

migueldv90 avatar Apr 19 '23 04:04 migueldv90

closing since CocoaPods 1.12.1 was released with the fix

jcesarmobile avatar Apr 19 '23 11:04 jcesarmobile

Hi, anyone are experience these issue? currently these is the issue that we encounter in our pipeline to generate an ipa file

Processing Info.plist

▸ Running script ‘[CP] Embed Pods Frameworks’

▸ Generating ‘App.app.dSYM’

** ARCHIVE FAILED **

The following build commands failed:

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/runner/Library/Developer/Xcode/DerivedData/App-azlyibamtvkrbhfwntgmcwffjqtw/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script-9592DBEFFC6D2A0C8D5DEB22.sh (in target ‘App’ from project ‘App’)

(1 failure)

RenzoPH avatar Apr 29 '23 03:04 RenzoPH

note: I have been struggling for 3hrs and notice that you should run capacitor update ios after updating cocoapods.

hinsxd avatar May 04 '23 03:05 hinsxd

Amazing. it worked for me thanks a lot

shuhad avatar May 28 '23 14:05 shuhad

I'll see about adding that to our docs if it's not in there.

markemer avatar May 30 '23 15:05 markemer

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

ionitron-bot[bot] avatar Jun 29 '23 15:06 ionitron-bot[bot]