ios Xcode 5.1 - 没有要编译的架构(ONLY_ACTIVE_ARCH=YES,active arch=x86_64,VALID_ARCHS=i386)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22328882/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode 5.1 - No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386)
提问by ebi
After updating to Xcode 5.1, I can no longer build my project for the 64-bit simulator, receiving this error:
更新到 Xcode 5.1 后,我无法再为 64 位模拟器构建我的项目,收到此错误:
No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386).
These are my target build settings:
这些是我的目标构建设置:
I tried changing "Build Active Architecture" to No, as well as adding "i386" to the "Valid Architectures", unfortunately neither worked. Thanks for any suggestions!
我尝试将“构建活动架构”更改为“否”,并将“i386”添加到“有效架构”中,但不幸的是两者都不起作用。感谢您的任何建议!
采纳答案by Mike Onorato
I had the same error message after upgrading to XCode 5.1. Are you using CocoaPods? If so, this should fix the problem:
升级到 XCode 5.1 后,我收到了相同的错误消息。你在使用 CocoaPods 吗?如果是这样,这应该可以解决问题:
- Delete the "Pods" project from the workspace in the left pane of Xcode and close Xcode.
- Run "pod install" from the command line to recreate the "Pods" project.
- Re-open Xcode and make sure "Build Active Architecture Only" is set to "No" in the build settings of both the "Pods" project and your own project.
- Clean and build.
- 从 Xcode 左窗格的工作区中删除“Pods”项目并关闭 Xcode。
- 从命令行运行“pod install”以重新创建“Pods”项目。
- 重新打开 Xcode 并确保在“Pods”项目和您自己的项目的构建设置中将“仅构建活动架构”设置为“否”。
- 清洁和建造。
回答by Kjuly
What you need to do is just set the ONLY_ACTIVE_ARCH
to NO
(at least works for me). Below is a screenshot for it:
您需要做的只是将其设置ONLY_ACTIVE_ARCH
为NO
(至少对我有用)。下面是它的屏幕截图:
EDIT:
编辑:
As far as I know (please point it out if there's something wrong, thanks), if you set ONLY_ACTIVE_ARCH
to YES
, it means the Xcode will only build for the active architecture (which refers to the device that's active in Xcode currently). Seems Xcode's default setting is set Debug to YES
, so it won't build binaries for other architectures when you only want to build for a special device that connected to your Mac.
据我所知(如果有问题请指出,谢谢),如果您设置ONLY_ACTIVE_ARCH
为YES
,则意味着 Xcode 将仅针对活动架构(指当前在 Xcode 中处于活动状态的设备)构建。似乎 Xcode 的默认设置设置为 Debug YES
,因此当您只想为连接到 Mac 的特殊设备构建时,它不会为其他架构构建二进制文件。
The reason failed to build might be that, the project does not support the architecture of the device you connected. So the best solution is to add the right architecture for your device.Below is a list for architectures & the devices that support:
构建失败的原因可能是,该项目不支持您连接的设备的架构。因此,最好的解决方案是为您的设备添加正确的架构。以下是支持的架构和设备列表:
- ARMv8/ARM64:
iPhone 6
,iPhone 5s
,iPad Air
,Retina iPad Mini
- ARMv7s:
iPhone 5
,iPhone 5c
,iPad 4
- ARMv7:
iPhone 3GS
,iPhone 4
,iPhone 4S
,iPod 3G/4G/5G
,iPad
,iPad 2
,iPad 3
,iPad Mini
- ARMv6:
iPhone
,iPhone 3G
,iPod 1G/2G
- ARMv8/ARM64:
iPhone 6
,iPhone 5s
,iPad Air
,Retina iPad Mini
- ARMv7s:
iPhone 5
,iPhone 5c
,iPad 4
- ARMv7:
iPhone 3GS
,iPhone 4
,iPhone 4S
,iPod 3G/4G/5G
,iPad
,iPad 2
,iPad 3
,iPad Mini
- ARMv6:
iPhone
,iPhone 3G
,iPod 1G/2G
So why "set the ONLY_ACTIVE_ARCH
to NO
"works? Because the device can still run the binary that built for all architectures you added (pass the build), but will lose some performance. This's just a quick solution, but not best.
那么为什么“设置ONLY_ACTIVE_ARCH
为NO
”有效呢?因为设备仍然可以运行为您添加的所有架构构建的二进制文件(通过构建),但会损失一些性能。这只是一个快速的解决方案,但不是最好的。
Note: The more architectures you added, the bigger the binary will be generated. So it's good to choose right architectures for your project. ;)
注意:您添加的架构越多,生成的二进制文件就越大。因此,为您的项目选择正确的架构是件好事。;)
回答by xardas
Add arm64
to the target's valid architectures
. Looks like it adds x86-64
architecture to simulator valid architectures as well.
添加arm64
到目标的valid architectures
. 看起来它也将x86-64
架构添加到模拟器有效架构中。
回答by samwize
If you are using CocoaPods, the most likely problem is because your Pods project Build Settings for Build Active Architecture Onlyis set to Yesfor Debug.
如果您使用 CocoaPods,最可能的问题是因为您的 Pods 项目的 Build Settings for Build Active Architecture Only设置为Yesfor Debug。
The solution is simple. Change it to No.
解决方法很简单。将其更改为No。
Similarly, change to Nofor your application project.
同样,将您的应用程序项目更改为No。
回答by Jayprakash Dubey
I had similar issue. Got it solved by changing "Architecture"to "$(ARCHS_STANDARD_32_BIT)" in Build Settings for Project.
我有类似的问题。通过在项目的构建设置中将“架构”更改为“ $(ARCHS_STANDARD_32_BIT)”解决了这个问题。
Now, you have to select Standard architectures (armv7, arm64) - $(ARCHS_STANDARD)since apple recommends apps to be build on 64-bit architecture. Click : Apple document
现在,您必须选择标准架构 (armv7, arm64) - $(ARCHS_STANDARD),因为 Apple 建议在 64 位架构上构建应用程序。点击:苹果文档
回答by AntonijoDev
Add: Architectures: $(ARCHS_STANDARD_INCLUDING_64_BIT)
添加:架构:$(ARCHS_STANDARD_INCLUDING_64_BIT)
Valid architectures: arm64 armv7 armv7s
有效架构:arm64 armv7 armv7s
回答by irs8925
Just in case, for anyone still encountering the issue despite following the above, check that the simulator you are running is also the supported one. I had mine specified to arm7 and arm7s but was trying to run the app on a 64 bit simulator.
以防万一,对于尽管遵循上述步骤仍然遇到问题的任何人,请检查您正在运行的模拟器是否也是受支持的模拟器。我已将我的指定为 arm7 和 arm7s,但试图在 64 位模拟器上运行该应用程序。
回答by Jake Hall
To avoid having "pod install" reset only_active_arch for debug each time it's run, you can add the following to your pod file
为避免每次运行时“pod install”重置 only_active_arch 进行调试,您可以将以下内容添加到您的 pod 文件中
# Append to your Podfile
post_install do |installer_representation|
installer_representation.project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
end
end
end
回答by Shauket Sheikh
Just add arm64 in valid architecture.i hope it will work for you.
只需在有效架构中添加 arm64。我希望它对你有用。
回答by Jano
My problem was that the Pods project was targeting OS X, despite my Podfile having platform :ios
. I'm using cocoapods 0.35.0.rc2.
我的问题是 Pods 项目的目标是 OS X,尽管我的 Podfile 有platform :ios
. 我正在使用 cocoapods 0.35.0.rc2。
To fix it, select the Pods project in the project navigator, and check that the Pods PROJECT node (mind you, not the Pods target) is targeting iOS. That is, the architectures build settings should be:
要修复它,请在项目导航器中选择 Pods 项目,然后检查 Pods PROJECT 节点(注意,不是 Pods 目标)是否针对 iOS。也就是说,架构构建设置应该是:
- Architectures:
$(ARCHS_STANDARD)
- Base SDK:
iOS 8.1
- Supported Platforms:
iOS
- Valid architectures:
$(ARCHS_STANDARD)
- 架构:
$(ARCHS_STANDARD)
- 基础SDK:
iOS 8.1
- 支持的平台:
iOS
- 有效的架构:
$(ARCHS_STANDARD)
I also wanted to build all architectures, so I added the following to the Podfile:
我还想构建所有架构,所以我在 Podfile 中添加了以下内容:
post_install do | installer |
installer.project.build_configurations.each do |config|
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
end
end