【发布时间】:2021-03-14 22:48:33
【问题描述】:
我的静态库是用 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 命令:
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"
在检查了 fat lib 中的架构后,我得到了:
$ lipo -info MyLibCommon.a
Architectures in the fat file: MyLibCommon.a are: armv7 i386 x86_64 arm64
但是,当我通过 cocoapods 将 lib 添加到项目中并在模拟器上在 Apple 的新 Silicon(带有 arm64 芯片组)上运行该项目时,出现以下编译错误:
building for iOS Simulator, but linking in object file built for iOS, file 'MyLibCommon.a' for architecture arm64
Excluding 模拟器的 arm64 架构不是一个选项,因为在 Apple Silicon Mac 上具有 arm64 芯片组。
知道如何为 Apple Silicon Simulator 构建静态库吗?
【问题讨论】:
标签: ios static-libraries simulator arm64 silicon