Closed pikzelz closed 3 years ago
Hi @pikzelz! Thank you for reporting.
Could you please take a look on the similar issue – https://github.com/cossacklabs/themis/issues/863. Does it feel the same? We are gathering evidence to understand what slice is missing :)
Also, could you please try to build the app on iOS device — does it work on device, but doesn't on Sim?
cc @ilammy @julepka
Hi @vixentael,
Thanks. I checked out the issue, but they seem to not be related. I've been able to build a working xcframework with modifying a build script I used in the past to create an xcframework.
What I also did was add the OpenSSL framework through SwiftPM instead of using the Carthage variant. This properly embeds OpenSSL within the .xcframework. I'm now able to run Themis within the simulator (haven't tested on device yet).
I also made sure that I removed ARM64 from the excluded architecture section in Xcode on the iOS target.
I used the following script to build the xcframework from xcode as an aggregate target:
#!/usr/bin/env bash
FWNAME="themis"
OUTPUT_DIR="./Release"
BUILD_DIR="${OUTPUT_DIR}/build"
COMMON=" -configuration Release -derivedDataPath ${BUILD_DIR} -quiet BUILD_LIBRARY_FOR_DISTRIBUTION=YES "
#iOS Devices
xcodebuild build \
$COMMON \
-scheme "Themis (iOS)" \
-sdk iphoneos \
-destination 'generic/platform=iOS'
rm -rf "${OUTPUT_DIR}/iphoneos"
mkdir -p "${OUTPUT_DIR}/iphoneos"
ditto "${BUILD_DIR}/Build/Products/Release-iphoneos/${FWNAME}.framework" "${OUTPUT_DIR}/iphoneos/${FWNAME}.framework"
rm -rf "${BUILD_DIR}"
#iOS Simulator
xcodebuild build \
$COMMON \
-scheme "Themis (iOS)" \
-sdk iphonesimulator \
-destination 'generic/platform=iOS Simulator' \
ONLY_ACTIVE_ARCH=NO
rm -rf "${OUTPUT_DIR}/iphonesimulator"
mkdir -p "${OUTPUT_DIR}/iphonesimulator"
ditto "${BUILD_DIR}/Build/Products/Release-iphonesimulator/${FWNAME}.framework" "${OUTPUT_DIR}/iphonesimulator/${FWNAME}.framework"
rm -rf "${BUILD_DIR}"
#macOS
xcodebuild build \
$COMMON \
-scheme "Themis (macOS)" \
-destination 'generic/platform=macOS' \
ONLY_ACTIVE_ARCH=NO
rm -rf "${OUTPUT_DIR}/macosx"
mkdir -p "${OUTPUT_DIR}/macosx/${FWNAME}.framework"
ditto "${BUILD_DIR}/Build/Products/Release/${FWNAME}.framework" "${OUTPUT_DIR}/macosx/${FWNAME}.framework"
rm -rf "${BUILD_DIR}"
xcodebuild -quiet -create-xcframework \
-framework "${OUTPUT_DIR}/iphoneos/${FWNAME}.framework" \
-framework "${OUTPUT_DIR}/iphonesimulator/${FWNAME}.framework" \
-framework "${OUTPUT_DIR}/macosx/${FWNAME}.framework" \
-output "${OUTPUT_DIR}/Frameworks/${FWNAME}.xcframework"
rm -rf "${OUTPUT_DIR}/iphoneos"
rm -rf "${OUTPUT_DIR}/iphonesimulator"
rm -rf "${OUTPUT_DIR}/macosx"
thank you @pikzelz! This is super helpful. We will make sure on adding macOS slice and publish a hotfix soon.
cc @julepka
@pikzelz Thanks for your help with this issue! Can you try the recent hotfix 0.13.12 and let us know if it works well for you? Thanks in advance!
@julepka Thanks! This works now. Can throw my local XCFramework away again!
💃 💃 💃 💃 💃
great job @julepka @pikzelz!
The xcframework is missing the required symbols for building iOS apps in the simulator when on M1 (arm64). They are present for macOS. Just not for iOS
To Reproduce Steps to reproduce the behavior:
Expected behavior Would expect to also build on the simulator
Environment (please complete the following information):