Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Converts an ARM64 iOS app with Bitcode into an X86_64 variant
#!/bin/bash
TARGET="$( cd "$(dirname "$1")" ; pwd -P )/$1"
SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
TARGET_ARCH=x86_64
export IPHONEOS_DEPLOYMENT_TARGET=12.2
rm -r /tmp/bitcode2intel
mkdir -p /tmp/bitcode2intel
pushd /tmp/bitcode2intel
ebcutil -a arm64 -e "$TARGET"
echo "Starting conversion of $TARGET"
for f in /tmp/bitcode2intel/*;
do clang -miphoneos-version-min=$IPHONEOS_DEPLOYMENT_TARGET -arch $TARGET_ARCH -fembed-bitcode -c -Xclang -disable-llvm-passes -emit-llvm -x ir -isysroot $SYSROOT $f -o $f.o;
done
clang -miphoneos-version-min=$IPHONEOS_DEPLOYMENT_TARGET -arch $TARGET_ARCH -fembed-bitcode -isysroot $SYSROOT *.o -o "$TARGET".intel
lipo "$TARGET" -remove $TARGET_ARCH -o "$TARGET"
lipo "$TARGET" -create -arch_blank $TARGET_ARCH -o "$TARGET"
lipo "$TARGET" -replace $TARGET_ARCH "$TARGET".intel -o "$TARGET"
popd
rm -r /tmp/bitcode2intel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.