Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build framework for multiple architectures (arm64, armv7, armv7s)

I'm trying to upload to TestFlight a project build for arm64, armv7, and armv7s. It is using a framework from another project. But the frameowork appears to be built only for arm64 and not arm64 (file was built for arm64 which is not the architecture being linked (armv7)).

The question is how do I make the framework containing all architectures? I want to keep the projects separated. And I don't care for simulators. I want to make sure it is built for release.

This is the framework target:

enter image description here

EDIT: My project is Cordova based. So it is using a plugin which utilize a pre-built framework. There are instructions out there for building a fat framework, containing simulators and device, then concatenating it with lipo. What I need is the architecture from the device I don't have as well. Does that actually mean I need three devices from arm64, armv7, and armv7s to be able to concatenating them altogether?

like image 559
huggie Avatar asked Feb 22 '18 09:02

huggie


2 Answers

Apple has discontinued support for 32-bit in iOS 11. You can neither run 32 bit apps on iOS 11 nor run iOS 11 on 32 bit processors. Thus, you have to set your Deployment Target to an iOS version earlier than iOS 11 for your framework.

like image 115
clemens Avatar answered Nov 09 '22 12:11

clemens


You can try to create an aggregate target and write an script which will support all the platform. This is sample script from one of my project.

unset TOOLCHAINS #Xcode 7.3 BUG FIX  http://stackoverflow.com/questions/36184930/xcodebuild-7-3-cant-enable-bitcode

# define output folder environment variable

C_PROJECT_NAME="<<YOUR_FRAMEWORK_NAME>>"

UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal

# Step 1. Build Device and Simulator versions
xcodebuild -target <<YOUR_FRAMEWORK_NAME>> ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"

xcodebuild -target <<YOUR_FRAMEWORK_NAME>> ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphonesimulator -arch i386 -arch x86_64 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"

mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"

rm -rf ./${C_PROJECT_NAME}.framework
cp -R ${BUILD_DIR}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}/${C_PROJECT_NAME}.framework ./

# Step 2. Create universal binary file using lipo

lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/${C_PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${C_PROJECT_NAME}.framework/${C_PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${C_PROJECT_NAME}.framework/${C_PROJECT_NAME}"

mv ${UNIVERSAL_OUTPUTFOLDER}/${C_PROJECT_NAME} ./${C_PROJECT_NAME}.framework/${C_PROJECT_NAME}
like image 1
Shohrab Avatar answered Nov 09 '22 11:11

Shohrab