Carthage icon indicating copy to clipboard operation
Carthage copied to clipboard

With XCode 14, Carthage throwing Command PhaseScript Execution failed with non zero exit code

Open amit-thakur-S opened this issue 3 years ago • 1 comments

  • carthage install method: [ ] .pkg, [ ✅ ] homebrew, [ ] source
  • which carthage: /usr/local/bin/carthage
  • carthage version: 0.38.0
  • xcodebuild -version: XCode 14.2 Build Version 14C18
  • Are you using --no-build? NO
  • Are you using --no-use-binaries? NO
  • Are you using --use-submodules? NO
  • Are you using --cache-builds? NO
  • Are you using --new-resolver? NO
  • Are you using --use-xcframeworks? YES

Carthage Output

exit code 0

Actual outcome Carthage compiles successfully When we build and run on simulator, the code throws 'Command Phase Script execution failed with non zero exit code' This happen when it tries to run the script for 'Remove unwanted architecture from Carthage'

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

EXTRACTED_ARCHS=()

for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done

echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"

echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

done

For every dependancies we get the error:

Executable is Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/Locksmith.framework/Locksmith
Extracting x86_64 from Locksmith
fatal error: lipo: input file (Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/Locksmith.framework/Locksmith) must be a fat file when the -extract option is specified
Merging extracted architectures: x86_64
fatal error: lipo: can't open input file: Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/Locksmith.framework/Locksmith-x86_64 (No such file or directory)
rm: Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/Locksmith.framework/Locksmith-x86_64: No such file or directory
Replacing original executable with thinned version
mv: rename Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/Locksmith.framework/Locksmith-merged to Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/Locksmith.framework/Locksmith: No such file or directory

🚀 When we enable the Run Script for 'For install builds only', we are able to build and run the code. 🚀 _ ❌ The above didnt work on our CircleCI pipelines ❌ _

Expected outcome Xcode should be able to build and run the code without any error during debug and archive builds.

Need help on how to make this work on the latest XCode.

amit-thakur-S avatar Dec 19 '22 14:12 amit-thakur-S

Apple XCode 14 Release Note states

Building iOS projects with deployment targets for the armv7, armv7s, and i386 architectures is no longer supported. (92831716)

Could this be an issue?

amit-thakur-S avatar Jan 04 '23 12:01 amit-thakur-S