grab / cocoapods-binary-cache

MIT License
474 stars 68 forks source link

[CP] Embed Pods Frameworks fails when Archiving #49

Closed spencerdiniz closed 3 years ago

spencerdiniz commented 3 years ago

Checklist

Issue Description

I'm attempting to use cocoapods-binary-cache in my project, but I'm having a problem archiving to app when using it. The app builds and runs successfully, but archiving fails. There's an execution error for the [CP] Embed Pods Frameworks script. See bellow:

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/spencerdiniz/Library/Developer/Xcode/DerivedData/Pixie-fyzwsjbzhfhiwrciwvfjfhfuzudr/Build/Intermediates.noindex/ArchiveIntermediates/Global\ TestFlight/IntermediateBuildFilesPath/Pixie.build/Debug-iphoneos/Pixsee\ Global.build/Script-E3CF3E6BE471CF8384D698BC.sh (in target 'Pixsee Global' from project 'Pixie')
    cd /Users/spencerdiniz/Work/Venturus/SourceCode/ios
    /bin/sh -c /Users/spencerdiniz/Library/Developer/Xcode/DerivedData/Pixie-fyzwsjbzhfhiwrciwvfjfhfuzudr/Build/Intermediates.noindex/ArchiveIntermediates/Global\\\ TestFlight/IntermediateBuildFilesPath/Pixie.build/Debug-iphoneos/Pixsee\\\ Global.build/Script-E3CF3E6BE471CF8384D698BC.sh

mkdir -p /Users/spencerdiniz/Library/Developer/Xcode/DerivedData/Pixie-fyzwsjbzhfhiwrciwvfjfhfuzudr/Build/Intermediates.noindex/ArchiveIntermediates/Global TestFlight/BuildProductsPath/Debug-iphoneos/Pixsee Global.app/Frameworks
Symlinked...
Command PhaseScriptExecution failed with a nonzero exit code

Any help would be greatly appreciated.

Environment

Plugin version

0.1.11

Installed CocoaPods plugins

Installed CocoaPods Plugins:
    - cocoapods-binary-cache : 0.1.11 (pre_install and post_install hooks)
    - cocoapods-deintegrate  : 1.0.4
    - cocoapods-plugins      : 1.0.0
    - cocoapods-search       : 1.0.0
    - cocoapods-stats        : 1.1.0 (post_install hook)
    - cocoapods-trunk        : 1.5.0
    - cocoapods-try          : 1.2.0
kientux commented 3 years ago

Anyone facing this problem can checkout this issue for a temporary workaround: https://github.com/CocoaPods/CocoaPods/issues/10298

sdiniz-truelogic commented 3 years ago

Thanks for suggestion. I’ll give it a try and report back.

thomaswinkler commented 3 years ago

@sdiniz-truelogic, see my comment/fix https://github.com/CocoaPods/CocoaPods/issues/10298#issuecomment-779455634. I found it to be missing path escaping in the readlink() wrapper implementation cocoapods-binary is adding. If your project name contains spaces, you will run into this issue.

rogerluan commented 3 years ago

@spencerdiniz I just opened a PR that should fix your issue 💪

sdiniz-truelogic commented 3 years ago

@spencerdiniz I just opened a PR that should fix your issue 💪

Nice! Thanks.

kevalgplutus commented 2 years ago

I am facing below error while trying to run fastlane lanes from jenkins but the flow is working fine with local terminal

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/jenkins/Library/Developer/Xcode/DerivedData/CDC-bzswrvazlutuhkeafnfspzbueoaa/Build/Intermediates.noindex/ArchiveIntermediates/WLA/IntermediateBuildFilesPath/CDC.build/WLA-iphoneos/CDC.build/Script-B8G2C0E378AF1A9BCC158ACE2.sh (in target 'CDC' from project 'CDC') Any help would be appreciated Thanks

DodoSpringLove commented 2 years ago

The same goes for you

umang2203 commented 1 year ago

I am facing similar issue

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Volumes/Workspace/jenkins/workspace/MyGame-Prod-iOS/bin/app/game/build/iphone/DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Script-D35EE720B184DEA10D74350E.sh (in target 'Unity-iPhone' from project 'Unity-iPhone')
    cd /Volumes/Workspace/jenkins/workspace/Test/MyGame-Prod-iOS/bin/app/game/build/iphone/src
    /bin/sh -c /Volumes/Workspace/jenkins/workspace/Test/MyGame-Prod-iOS/bin/app/game/build/iphone/DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Script-D35EE720B184DEA10D74350E.sh
mkdir -p /Volumes/Workspace/jenkins/workspace/Test/MyGame-Prod-iOS/bin/app/game/build/iphone/DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/Unity-iPhone/BuildProductsPath/Release-iphoneos/MyGame.app/Frameworks
Symlinked...
readlink: illegal option -- f
usage: readlink [-n] [file ...]

Command PhaseScriptExecution failed with a nonzero exit code

amanbabbar-kipl commented 1 year ago

I am running Fastlane on the Mac agent node with the Jenkins controller and facing the same issue.

The following build commands failed: 16:24:29 PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/macstudio/Library/Developer/Xcode/DerivedData/brandvox-ckdfytqcvospulgotnphrsyjlrdl/Build/Intermediates.noindex/ArchiveIntermediates/brandvox/IntermediateBuildFilesPath/brandvox.build/Release-iphoneos/brandvox.build/Script-00EEFC60759A1932668264C0.sh

Command PhaseScriptExecution failed with a nonzero exit code

Did anyone found the solution?

sergey1w commented 11 months ago

For me this small adjustment helped: Go to ${PODS_ROOT}"/Target Support Files/Pods-AppName/Pods-AppName-frameworks.sh" Line 42 in my file:

  if [ -L "${source}" ]; then
    echo "Symlinked..."
    source="$(readlink -f "${source}")" # add "-f" option to the readlink command
  fi
closure11 commented 9 months ago

For anyone still facing the Command PhaseScriptExecution failed with a nonzero exit code issue after updating CocoaPods 1.12.1:

CocoaPods has added the -f option when resolving the path to the symlinked source, which makes this overridden readlink function broken.

https://github.com/grab/cocoapods-binary-cache/blob/f85630964fa5fde96239fe97a769e4c3160e443d/lib/cocoapods-binary-cache/pod-binary/integration/patch/embed_framework_script.rb#L18-L20

This code expects the first argument $1 to be a file path, but now it's actually -f:

  # Pods-MyApp-frameworks.sh
  if [ -L "${source}" ]; then
    echo "Symlinked..."
    source="$(readlink -f "${source}")"
  fi

Can the maintainer fix this please?

What's more

Some comments in CocoaPods issues said changing readlink -f "${source}" to greadlink -f "${source}", if this issue can't be solved with the readlink -f command.

This greadlink did solve the problem, but at the time I didn't realize why it works, and why the vast majority of other people didn't need to do it. Now I find that it has to do with cocoapods-binary-cache.

lucasromanomr commented 2 months ago

I'm having the same problem currently using Xcode 15.4