我从 XCode 6 转移到 XCode 7 并且没有对源、项目或任何我的存档构建开始失败的任何更改。
经过研究lipo
产生的错误:
lipo:.../Release-iphoneos/libSDWebImage.a and .../Release-iphonesimulator/libSDWebImage.a have the same architectures (i386) and can't be in the same fat output file
我发现了以下内容:
在 XCode 6 中,lipo -info
返回 fat 文件中的架构:.../Release-iphoneos/libSDWebImage.a 是:armv7 arm64
和 胖文件中的体系结构:.../Release-iphonesimulator/libSDWebImage.a 是:i386 x86_64
这是正确的。我有用于 iphone 设备的 arm 和用于 iphone 模拟器的 i386。
在 XCode 7 中,这两个文件是相同的,并且具有 i386 架构!因此,使用 lipo 将这两个 .a
文件合并为一个文件的框架脚本失败了。
为什么 XCode 7 突然停止为 arm 构建我的 SDWebImage
框架?项目设置不变,库相同,方案将存档设置为发布。请帮忙。
iMac:~ lukasz$ lipo -info /Users/lukasz/Library/Developer/Xcode/DerivedData/…-etcsjmgakpylpmgchumhnsqpyrev/Build/Intermediates/ArchiveIntermediates/adhoc-stage/BuildProductsPath/Release-iphoneos/libSDWebImage.a
input file /Users/lukasz/Library/Developer/Xcode/DerivedData/…-etcsjmgakpylpmgchumhnsqpyrev/Build/Intermediates/ArchiveIntermediates/adhoc-stage/BuildProductsPath/Release-iphoneos/libSDWebImage.a is not a fat file
Non-fat file: /Users/lukasz/Library/Developer/Xcode/DerivedData/…-etcsjmgakpylpmgchumhnsqpyrev/Build/Intermediates/ArchiveIntermediates/adhoc-stage/BuildProductsPath/Release-iphoneos/libSDWebImage.a is architecture: i386
iMac:~ lukasz$ lipo -info /Users/lukasz/Library/Developer/Xcode/DerivedData/…-etcsjmgakpylpmgchumhnsqpyrev/Build/Intermediates/ArchiveIntermediates/adhoc-stage/BuildProductsPath/Release-iphonesimulator/libSDWebImage.a
input file /Users/lukasz/Library/Developer/Xcode/DerivedData/…-etcsjmgakpylpmgchumhnsqpyrev/Build/Intermediates/ArchiveIntermediates/adhoc-stage/BuildProductsPath/Release-iphonesimulator/libSDWebImage.a is not a fat file
Non-fat file: /Users/lukasz/Library/Developer/Xcode/DerivedData/…-etcsjmgakpylpmgchumhnsqpyrev/Build/Intermediates/ArchiveIntermediates/adhoc-stage/BuildProductsPath/Release-iphonesimulator/libSDWebImage.a is architecture: i386
最佳答案
我在尝试在 Xcode 7 上构建多架构框架时遇到了同样的问题。看起来你正在构建一个静态库,这是不同的,但可能是相关的。我假设您正在使用 xcodebuild
命令(在聚合目标运行脚本中?)为不同的 SDK 构建您的库,然后在最后执行 lipo
以加入所有他们。
我的问题是正在构建的框架/库位于 build/UninstalledProducts
文件夹中,BUILD_DIR
中的内容是指向它的符号链接(symbolic link)。所以你的 Release-iphoneos
和 Release-iphonesimulator
中的库很可能是同一个库的别名,因此你会看到它们具有相同的架构(i386
在你的情况下)。
为避免这种情况,请在 Xcode 中导航到静态库目标的“build设置”,并确保“部署”下的以下内容:
Deployment Location
isNO
for release部署后处理
NO
发布
您应该会看到构建不再输出 UninstalledProducts
文件夹,并且 BUILD_DIR
中构建的所有库/框架都是唯一文件,它们现在应该具有正确的架构。然后,您可以使用 lipo
对它们做任何您喜欢的事情。在尝试上述操作之前,您可能必须删除 DerivedData
。
关于ios - Xcode 7 为 Release-iphoneos 构建 i386 而不是 arm 二进制文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32841578/