Xcode 7为Release-iphoneos构建i386而不是arm二进制



我从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 arm64Architectures in the fat file: .../Release-iphonesimulator/libSDWebImage.a are: i386 x86_64,这是正确的。我有arm的iphone设备和i386的iphone模拟器。

在XCode 7中,这两个文件是相同的,并且具有i386架构!因此,使用lipo将这两个.a文件合并为一个的框架脚本将失败。

为什么XCode 7突然停止构建我的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-iphoneosRelease-iphonesimulator中的库很可能是同一个库的别名,因此您可以看到它们具有相同的体系结构(在您的示例中为i386)。

为了避免这种情况,导航到Xcode中静态库目标的"Build Settings",并确保在"Deployment"下进行以下设置:

  1. Deployment LocationNO的释放
  2. Deployment PostprocessingNO的释放

您应该看到构建不再输出UninstalledProducts文件夹,并且BUILD_DIR中构建的所有库/框架都是唯一的文件,现在应该具有正确的体系结构。然后你可以用lipo做任何你喜欢的事情。在尝试上述操作之前,您可能必须删除DerivedData

对于我来说,修复方法是从Yes no no(这是默认值)设置"跳过安装"。所以确保除了Andrew Wei提到的其他两个选项。

最新更新