我从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
返回Architectures in the fat file: .../Release-iphoneos/libSDWebImage.a are: armv7 arm64
和Architectures in the fat file: .../Release-iphonesimulator/libSDWebImage.a are: i386 x86_64
,这是正确的。我有arm的iphone设备和i386的iphone模拟器。
在XCode 7中,这两个文件是相同的,并且具有i386架构!因此,使用lipo将这两个.a
文件合并为一个的框架脚本将失败。
SDWebImage
框架的手臂?项目设置不变,库相同,方案将Archive设置为Release。请帮助。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
中的生活是符号链接。因此,Release-iphoneos
和Release-iphonesimulator
中的库很可能是同一个库的别名,因此您可以看到它们具有相同的体系结构(在您的示例中为i386
)。
为了避免这种情况,导航到Xcode中静态库目标的"Build Settings",并确保在"Deployment"下进行以下设置:
-
Deployment Location
是NO
的释放 -
Deployment Postprocessing
是NO
的释放
您应该看到构建不再输出UninstalledProducts
文件夹,并且BUILD_DIR
中构建的所有库/框架都是唯一的文件,现在应该具有正确的体系结构。然后你可以用lipo
做任何你喜欢的事情。在尝试上述操作之前,您可能必须删除DerivedData
。
对于我来说,修复方法是从Yes no no(这是默认值)设置"跳过安装"。所以确保除了Andrew Wei提到的其他两个选项。