Run custom shell script '[CP] Embed Pods Frameworks'
Asked Answered
C

8

18

i am maintaining a capacitor ionic project supporting both iOS and android platform. I can build the project locally and run it on a device without any issue. But when archiving the following error pops up:

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks 
/Users/fabus/Library/Developer/Xcode/DerivedData/App-
gkhellzebxgrxeeuozvkjsnejnul/Build/Intermediates.noindex/ArchiveInter
mediates/App/IntermediateBuildFilesPath/App.build/Release-
iphoneos/App.build/Script-9592DBEFFC6D2A0C8D5DEB22.sh (in target 
'App' from project 'App')     cd 
/Users/fabus/Development/showmaker/showmaker_festivals/ios/App     
/bin/sh -c /Users/fabus/Library/Developer/Xcode/DerivedData/App-
gkhellzebxgrxeeuozvkjsnejnul/Build/Intermediates.noindex/ArchiveInter
mediates/App/IntermediateBuildFilesPath/App.build/Release-
iphoneos/App.build/Script-9592DBEFFC6D2A0C8D5DEB22.sh
mkdir -p /Users/fabus/Library/Developer/Xcode/DerivedData/App-
gkhellzebxgrxeeuozvkjsnejnul/Build/Intermediates.noindex/ArchiveInter
mediates/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/Cap
acitor.framework" 
"/Users/fabus/Library/Developer/Xcode/DerivedData/App-
gkhellzebxgrxeeuozvkjsnejnul/Build/Intermediates.noindex/ArchiveInter
mediates/App/InstallationBuildProductsLocation/Applications/App.app/F
rameworks" building file list ... rsync: link_stat 
"/Users/fabus/Development/showmaker/showmaker_festivals/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

I am using following pods:

  pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'

  pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'

  pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'

  pod 'CapacitorBrowser', :path => '../../node_modules/@capacitor/browser'

  pod 'CapacitorHaptics', :path => '../../node_modules/@capacitor/haptics'

  pod 'CapacitorKeyboard', :path => '../../node_modules/@capacitor/keyboard'

  pod 'CapacitorNetwork', :path => '../../node_modules/@capacitor/network'

  pod 'CapacitorPushNotifications', :path => '../../node_modules/@capacitor/push-notifications'

  pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen'

  pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'

  pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins'

  pod 'CordovaPluginsStatic', :path => '../capacitor-cordova-ios-plugins'

I already desintegrated/updated pods in my ios folder. Cleaned the Build folder shift-command-k. Further there's no special chars or whitespaces in my project name and I did renew all my certificates / load them into xcode. Restarting machine does not solve it either.

What I did as well, was checking the option "For install build only" in my Build phases (Targets > App > Build phases) as suggested here

I haven't touched my build files (capacitor.config, package.json, ...) lately

Update:

Executing the command by hand produces following ouput:

/Users/fabus/Library/Developer/Xcode/DerivedData/App-gkhellzebxgrxeeuozvkjsnejnul/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script-9592DBEFFC6D2A0C8D5DEB22.sh: line 2: /Target Support Files/Pods-App/Pods-App-frameworks.sh: No such file or directory
Coop answered 3/4, 2023 at 16:50 Comment(0)
T
67

It seems like there is an issue on Xcode 14.3 and higher. There are open issues on iOS developer forum.

ref: https://developer.apple.com/forums/thread/725230?answerId=746897022#746897022

An idea could be to downgrade to 14.2 and see if it works.

Another workaround without downgrading: Open project in Xcode. Go to Pods -> Target Support Files -> Pods-App-Frameworks and change line 44 to below (basically adding -f in existing code):

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

New Solution: update cocoapods version to the latest one and it should resolve automatically.

Tammeratammi answered 4/4, 2023 at 13:29 Comment(14)
Indeed! I downgraded to 14.2 - clean install it just works!!! Thank you very much, you saved my day!!!Coop
Nice solution. Can you explain why we need to force (add the -f flag) ?Victimize
@thomasmary in this context, the -f flag stands for "canonicalize." It is used to get the absolute path of the specified file or directory, resolving all symbolic links and relative paths. So line 44 sets the source variable to the absolute path of the file or directory it originally pointed to, resolving any symbolic links and relative paths in the process.Tammeratammi
Thank you! The Pods-app-frameworks -f fix works well on Xcode 14.3 for IDE builds and ipa archiving with the xcodebuild CLI. The error showed up as "cocoapods DVTCoreDeviceEnabledState" when building an ionic capacitor app from command line.Pouncey
your other work around work for me and thanks a lot I was stuck with that for 2 daysStrew
Worked for me 14.3Belize
Couldn't find the option you describe in xcode, on the other hand as stated in the link you provided there is a file that is way easier to find in APPNAME/ios/App/Pods/Target Support Files/Pods-YOURAPP/Pods-YOURAPP-frameworks.sh.Eveevection
I have also the same issueScuff
I have edited and updated the answer.Tammeratammi
This should be the accepted answer. Updating Cocoapods did not fix anything for me.Adaurd
Updating to the latest version of cocoapods didn't fix this issue for me either, but doing source="$(readlink -f "${source}")" in my Pods -> Target Support Files -> Pods-[your app name]-Frameworks.sh did fix it! Thank you!Wheelock
Running in CocoaPod 1.13 and Xcode 15. The source="$(readlink -f "${source}")" is correct for me, but still got this error.Liveryman
for me just upgrading cocoapods for last version solved the problem, thank youPelagic
@Liveryman did you try updating cocoa pods to latest version instead?Tammeratammi
S
28

Update cocoapods to 1.12.1 which has the fix.

gem update cocoapods, or bundle update cocopods if using bundle, or brew upgrade cocoapods if installed with brew.

Sargassum answered 23/4, 2023 at 14:46 Comment(4)
This is the better answer because it persists even after removing the Pods directory and reinstalling afresh (e.g. on a new machine).Albertinealbertite
@Albertinealbertite as you could see from the date when I answered, cocoapods didn't have a fix with an update yet.Tammeratammi
@RoshanKhadka Your answer was an effective solution for an urgent need. Now that cocoapods does have a fix, however, this answer now provides the more durable -- and therefore better -- solution to the problem.Albertinealbertite
@Albertinealbertite of course, agreed!Tammeratammi
E
8

Look Like similar . It's work https://developer.apple.com/forums/thread/727525

There is an issue with Cocoapods now, because Xcode 14.3 is now using a relative path in its symlink for frameworks.

Either wait for release of Cocoapods version 1.12.1 or make this simple change in your Pods-APPNAME-frameworks.sh file:

Replace:

  if [ -L "${source}" ]; then
    echo "Symlinked..."
    source="$(readlink "${source}")"
  fi

with:

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

Note that -f was added.

Extrusive answered 6/9, 2023 at 8:23 Comment(1)
Great its working for me. i search Pods-APPNAME-frameworks.sh file from whole project and search code that i have to replace then replace below code if [ -L "${source}" ]; then echo "Symlinked..." source="$(readlink -f "${source}")" fiMegadeath
W
2

Find the file Pods-App-Fremeworks.sh and change the code:

if [ -L "${source}" ]; then
    echo "Symlinked..."
    source="$(readlink "${source}")"
fi

for this: (add the -f options after r

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

It's worked for me. I hope to help you.

Woofer answered 2/5, 2023 at 19:16 Comment(2)
No it didn't helpScuff
Make Build Options "User Script Sandboxing" Yes to No in Xcode 15 or later.Eventual
P
2

Once you do the below change:

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

We need to do this steps to make it work:

  1. Do Pods deintegrate and integrate back.
  2. Clear build folder & derived data in xCode.
  3. Try to Build or Archive again.
Plover answered 23/5, 2023 at 12:19 Comment(0)
F
2

Type echo "Symlinked..." in Xcode search.

Add -f after readlink

Or replace source="$(readlink "${source}")" with source="$(readlink -f "${source}")"

It's working fine for me.

Fancier answered 25/5, 2023 at 12:38 Comment(0)
E
1

Make Build Options "User Script Sandboxing" Yes to No in Xcode 15 or later.

Eventual answered 12/6, 2024 at 14:7 Comment(0)
U
0

Face the same problem.

If you're using Gitlab pipeline, try to install cocoapods at before_script in .yml

before_script:
  - export PATH=$PATH:/Users/gitlab/.asdf/installs/ruby/3.0.3/bin
  - gem install cocoapods
  - pod setup

or try to change image to macos-12-xcode-14

ex:

build_ios:
  image: macos-12-xcode-14
  stage: build
  script:
    # intall pod
    - pod --version
    - pod install --repo-update

    # build app
    - bundle exec fastlane build_production
    
  artifacts:
    paths:
      - ./*.ipa

  tags: 
    - saas-macos-medium-m1
Unlettered answered 12/10, 2023 at 6:44 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.