Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
amit-thakur-S opened this issue Dec 19, 2022 · 1 comment

Comments

@amit-thakur-S
Copy link

amit-thakur-S commented Dec 19, 2022

  • 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
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant