私の静的ライブラリは xcodebuild でビルドされ、シミュレータとデバイスのビルド結果からファット ライブラリが作成されます。これが私のxcodebuildコマンドです:
xcodebuild OTHER_CFLAGS="-fembed-bitcode" -configuration "iphoneos" -target "${LIB_NAME}Common" -sdk iphoneos
xcodebuild OTHER_CFLAGS="-fembed-bitcode" -configuration "iphonesimulator" -target "${LIB_NAME}Common" -sdk iphonesimulator
リポコマンド:
lipo -create "${DEVICE_DIR}/lib${LIB_NAME}Common.a" "${SIMULATOR_DIR}/lib${LIB_NAME}Common.a" -output "${INSTALL_DIR}/include/${LIB_NAME}/lib${LIB_NAME}Common.a"
ファット ライブラリのアーキテクチャを確認したところ、次の結果が得られました。
$ lipo -info MyLibCommon.a
Architectures in the fat file: MyLibCommon.a are: armv7 i386 x86_64 arm64
ただし、cocoapods を介して lib をプロジェクトに追加し、シミュレーターで Apple の新しいシリコン (arm64 チップセットを搭載) でプロジェクトを実行すると、次のコンパイル エラーが発生しました。
building for iOS Simulator, but linking in object file built for iOS, file 'MyLibCommon.a' for architecture arm64
Apple Silicon Mac には arm64 チップセットがあるため、シミュレータの arm64 アーキテクチャを除外することはできません。
Apple Silicon Simulator の静的ライブラリを構築するにはどうすればよいですか?