aws-sdk-ios
aws-sdk-ios copied to clipboard
OCMock binary is not compatible with Apple Silicon M1 Macs
Describe the bug
The OCMock binary (libOCMock.a) has not been built for modern Apple Silicon and is included in the repo as a binary. It will need to be updated to include a slice for arm64 for Apple Silicon.
To Reproduce Steps to reproduce the behavior:
- Clone SDK repo to M1 Mac
- Build
- Run tests
- See error
Since this binary has not been updated in a while and the header files are in the OCMock folder it will require finding the version originally used for this build or update the SDK to use a newer version of OCMock. Below are the build commands which could b used once the right version is selected. It may be close to v3.0.
CONFIGURATION=Release
xcodebuild -project Source/OCMock.xcodeproj clean
xcodebuild -project Source/OCMock.xcodeproj -scheme OCMockLib -sdk iphoneos15.0 -configuration ${CONFIGURATION} build
xcodebuild -project Source/OCMock.xcodeproj -scheme OCMockLib -sdk iphonesimulator15.0 -configuration ${CONFIGURATION} build
Here is the full script.
#!/bin/sh
# git clone [email protected]:erikdoe/ocmock.git ocmock
# git checkout tags/v3.0 -b v3.0-branch
OUTPUT_DIR="./Output"
if [ -d "${OUTPUT_DIR}" ]; then
rm -rf "${OUTPUT_DIR}"
fi
CONFIGURATION=Release
xcodebuild -project Source/OCMock.xcodeproj clean
xcodebuild -project Source/OCMock.xcodeproj -scheme OCMockLib -sdk iphoneos15.0 -configuration ${CONFIGURATION} build
xcodebuild -project Source/OCMock.xcodeproj -scheme OCMockLib -sdk iphonesimulator15.0 -configuration ${CONFIGURATION} build
BUILD_PATH=$(locate-build-path)
PLATFORMS="iphoneos iphonesimulator"
mkdir -p "${OUTPUT_DIR}"
for PLATFORM in ${PLATFORMS}; do
LIBRARY_PATH="${BUILD_PATH}/Build/Products/${CONFIGURATION}-${PLATFORM}/libOCMock.a"
if [ -f "${LIBRARY_PATH}" ]; then
mkdir -p "${OUTPUT_DIR}/${PLATFORM}"
cp "${LIBRARY_PATH}" "${OUTPUT_DIR}/${PLATFORM}"
fi
if [ "iphoneos" == "${PLATFORM}" ]; then
HEADERS_PATH="${BUILD_PATH}/Build/Products/${CONFIGURATION}-${PLATFORM}/OCMock"
if [ -d "${HEADERS_PATH}" ]; then
cp -rp "${HEADERS_PATH}" "${OUTPUT_DIR}"
fi
fi
done
Since libOCMock.a
is linked directly by many test targets the most minimal change would be to replace that binary. I do not know if a FAT binary will work in this case since arm64 for Macs may be different than it is for iPhones which are also arm64. If a single binary can work for Intel and M1 Macs to build and run tests that would be the option which has the fewest changes.
Related https://github.com/aws-amplify/aws-sdk-ios/commits/stehlib.3939-ocmock
Why not to build OCmock as xcframework? that should resolve the issue no? O I see it was already added in the artifacts https://github.com/erikdoe/ocmock/releases