Compilation fails on Xcode10.1
thibauddavid opened this issue · 16 comments
Hi,
XCode10.1 (released today) breaks SDK compilation when building for device due to arm64e architecture not being found on framework.
fatal error: lipo: -extract arm64e specified but fat file:/Users/****/Library/Developer/Xcode/DerivedData/******/Frameworks/BatchExtension.framework/BatchExtension does not contain that architecture
fatal error: lipo: can't open input file: /Users/****/Library/Developer/Xcode/DerivedData/*****/Frameworks/BatchExtension.framework/BatchExtension-arm64e (No such file or directory)
rm: /Users/****/Library/Developer/Xcode/DerivedData/Frameworks/BatchExtension.framework/BatchExtension-arm64e: No such file or directory
/Users/****/Library/Developer/Xcode/DerivedData/Frameworks/BatchExtension.framework/BatchExtension: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
Still works as expected on simulator.
SDK added via Cocoapods, using run script to strip unused architectures when building # Strip Batch framework bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/BatchExtension.framework/strip-frameworks.sh"
Thanks
Hello,
We'll release the arm64e slices after some testing (there has been quite weird issues with the 10.1 betas).
A fix until now is to override the "Valid architectures" build setting with everything except arm64e. It should usually be "arm64 armv7 armv7s" for most projects
Thanks for answering this quick. Keep us in touch once fixed if you can :)
Sure! We'll have a patch release with arm64e slices by next tuesday
Also interested :), ping us :)
Batch 1.13.1 has been released. Both the main framework and BatchExtension now have a arm64e slice: you can now remove the workaround described higher up
Reopening: Looks like Xcode didn't generate Bitcode for arm64e, which leads to problems when archiving for ad-hoc distribution.
The workaround described higher up still applies
While we figure out how to make Xcode produce arm64e bitcode, here is a strip-frameworks.sh that just ignores the arm64e slice. No changes to "valid architectures" needed.
You can also apply this to Batch 1.13.0 and lower, as this includes a fix to unexpected VALID_ARCHITECTURE values
# strip-frameworks.sh
# BatchExtension
#
# Copyright © 2016 Batch.com. All rights reserved.
FRAMEWORK_DIRECTORY="${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/BatchExtension.framework"
FRAMEWORK_BINARY_PATH="${FRAMEWORK_DIRECTORY}/BatchExtension"
individual_slices_paths=()
# Split the fat framework into one file per valid slice
for arch in $VALID_ARCHS; do
# Temporary arm64e patch, remove once 1.13.2 is released
if [[ $arch == "arm64e" ]]; then
continue
fi
slice_path="$FRAMEWORK_BINARY_PATH-$arch"
lipo -extract "$arch" "$FRAMEWORK_BINARY_PATH" -o "$slice_path"
if [ $? -eq 0 ]; then
individual_slices+=("$slice_path")
fi
done
# Delete the fat framework and merge everything back, then clean up
rm "${FRAMEWORK_BINARY_PATH}"
lipo -create "${individual_slices[@]}" -o "${FRAMEWORK_BINARY_PATH}"
rm "${individual_slices[@]}"
# Codesign if needed
if [ "${CODE_SIGNING_REQUIRED}" == "YES" ]; then
/usr/bin/codesign --force --sign "${EXPANDED_CODE_SIGN_IDENTITY}" --preserve-metadata=identifier,entitlements "${FRAMEWORK_BINARY_PATH}"
fi
Didn't find a way to make Xcode output arm64e bitcode yet. I opened the radar 45875280
Since the arm64e slices are removed when submitting on TestFlight/App Store anyway (https://developer.apple.com/documentation/xcode_release_notes/xcode_10_1_release_notes?language=objc), 1.13.1 release zips have been updated to include the patched shell script.
The frameworks will still have their arm64e slices, but the extension strip script will ignore it.
Feel free to comment on this issue if this doesn't fit your use case.
So can we consider this as fixed ?
It is fixed (more exactly: it has been worked around), but it might break when arm64e goes out of preview
Officially marking this as fixed. Will reopen when something breaks with an Xcode update
Hello, still having this issue with Xcode 10.1 and Batch 1.13.2, from what I have understood from this thread, this issue is supposed to be solved with Batch 1.13.2 ? Should I add the script ?
The issue is solved with 1.13.2 but you have to redownload the extension and replace the one in your project
I too am having this issue with Batch 1.13.2 using cocoapods when archiving. What do you mean by redownload the extension ?
It is needed to manually redownload BatchExtension from github or our website and upgrade it by copying it
The extension is not upgradable via cocoapods for the moment
Oh ok I missed the part where the extension framework had to be included manually. Now it works fine thanks =)