简体   繁体   English

Xcode 5.1 - 没有要编译的体系结构(ONLY_ACTIVE_ARCH = YES,活动arch = x86_64,VALID_ARCHS = i386)

[英]Xcode 5.1 - No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386)

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: 这些是我的目标构建设置:

Xcode目标构建设置

I tried changing "Build Active Architecture" to No, as well as adding "i386" to the "Valid Architectures", unfortunately neither worked. 我尝试将“Build Active Architecture”更改为No,并将“i386”添加到“Valid Architectures”,但遗憾的是两者都没有。 Thanks for any suggestions! 谢谢你的任何建议!

What you need to do is just set the ONLY_ACTIVE_ARCH to NO (at least works for me). 你需要做的只是将ONLY_ACTIVE_ARCH设置为NO (至少对我ONLY_ACTIVE_ARCH )。 Below is a screenshot for it: 下面是它的截图:


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). 据我所知( 如果出现问题,请指出,谢谢 ),如果将ONLY_ACTIVE_ARCH设置为YES ,则表示Xcode仅针对活动架构(指当前在Xcode中处于活动状态的设备)构建。 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. 似乎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 ARMv8 / ARM64: iPhone 6iPhone 5siPad AirRetina iPad Mini
  • ARMv7s: iPhone 5 , iPhone 5c , iPad 4 ARMv7s: iPhone 5iPhone 5ciPad 4
  • ARMv7: iPhone 3GS , iPhone 4 , iPhone 4S , iPod 3G/4G/5G , iPad , iPad 2 , iPad 3 , iPad Mini ARMv7: iPhone 3GSiPhone 4iPhone 4SiPod 3G/4G/5GiPadiPad 2iPad 3iPad Mini
  • ARMv6: iPhone , iPhone 3G , iPod 1G/2G ARMv6: iPhoneiPhone 3GiPod 1G/2G

So why "set the ONLY_ACTIVE_ARCH to NO " works? 那么为什么“将ONLY_ACTIVE_ARCH设置为NO有效呢? 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. 这只是一个快速的解决方案,但不是最好的。


Note : The more architectures you added, the bigger the binary will be generated. 注意 :您添加的架构越多,生成的二进制文件就越大。 So it's good to choose right architectures for your project. 因此,为您的项目选择正确的架构是件好事。 ;) ;)

I had the same error message after upgrading to XCode 5.1. 升级到XCode 5.1后,我收到了同样的错误消息。 Are you using CocoaPods? 你在使用CocoaPods吗? If so, this should fix the problem: 如果是这样,这应该解决问题:

  1. Delete the "Pods" project from the workspace in the left pane of Xcode and close Xcode. 从Xcode左窗格中的工作区中删除“Pods”项目并关闭Xcode。
  2. Run "pod install" from the command line to recreate the "Pods" project. 从命令行运行“pod install”以重新创建“Pods”项目。
  3. 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. 重新打开Xcode并确保“Pods”项目和您自己的项目的构建设置中的“Build Active Architecture Only”设置为“No”。
  4. Clean and build. 清洁和建造。

Add arm64 to the target's valid architectures . arm64添加到目标的valid architectures Looks like it adds x86-64 architecture to simulator valid architectures as well. 看起来它也将x86-64架构添加到模拟器有效架构中。

If you are using CocoaPods, the most likely problem is because your Pods project Build Settings for Build Active Architecture Only is set to Yes for Debug. 如果您正在使用CocoaPods,最可能的问题是因为您的Pods项目Build Build Architecture for Build Active设置为Yes for Debug。

The solution is simple. 解决方案很简单。 Change it to No . 将其更改为

Similarly, change to No for your application project. 同样,对您的应用程序项目更改为“ ”。

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. 现在,您必须选择标准体系结构(armv7,arm64) - $(ARCHS_STANDARD),因为Apple建议在64位体系结构上构建应用程序。 Click : Apple document 单击: Apple文档

Add: Architectures: $(ARCHS_STANDARD_INCLUDING_64_BIT) 添加:架构:$(ARCHS_STANDARD_INCLUDING_64_BIT)

Valid architectures: arm64 armv7 armv7s 有效的架构:arm64 armv7 armv7s

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位模拟器上运行应用程序。

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

只需在有效的架构中添加arm64。我希望它能为您服务。

My problem was that the Pods project was targeting OS X, despite my Podfile having platform :ios . 我的问题是Pods项目的目标是OS X,尽管我的Podfile有platform :ios I'm using cocoapods 0.35.0.rc2. 我正在使用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. 要修复它,请在项目导航器中选择Pods项目,并检查Pods PROJECT节点(请注意,而不是Pods目标)是否针对iOS。 That is, the architectures build settings should be: 也就是说,架构构建设置应该是:

  • Architectures: $(ARCHS_STANDARD) 架构: $(ARCHS_STANDARD)
  • Base SDK: iOS 8.1 基础SDK: iOS 8.1
  • Supported Platforms: iOS 支持的平台: iOS
  • Valid architectures: $(ARCHS_STANDARD) 有效的架构: $(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

I had to add the following i386 and x86_64 to Valid Architectures . 我必须将以下i386x86_64添加到Valid Architectures I'm running Xcode 7.2 and targeting iOS 8+. 我正在运行Xcode 7.2并以iOS 8+为目标。 I already had armv7 , armv7s and arm64 in there and that was working in Xcode 6.4. 我已经在那里安装了armv7armv7sarm64 ,这在Xcode 6.4中有效。

I faced the same problem when running my app on iPad using xcode 5.1. 我在使用xcode 5.1在iPad上运行我的应用时遇到了同样的问题。 It got resolved by removing armv7s from 'valid architectures' and setting the 'build active architectures only' value to No. Both these fields can be found in your app->targets->build settings->architectures. 它通过从“有效架构”中删除armv7并将“仅构建活动架构”值设置为否来解决。这些字段都可以在app-> targets-> build settings->架构中找到。

I arrived at this question due to a problem with command line build for simulator in Xcode 7.2. 由于Xcode 7.2中模拟器的命令行构建问题,我得出了这个问题。 In case anyone else gets here with the same issue, I will share the solution I found: 如果其他人带着同样的问题来到这里,我会分享我找到的解决方案:

Apparently there is a bug in Xcode 7.2 that causes xcodebuild to fail when trying to build for simulator. 显然,Xcode 7.2中存在一个错误 ,导致xcodebuild在尝试构建模拟器时失败。 The solution is to specify the option "-destination", eg: 解决方案是指定选项“-destination”,例如:

xcodebuild -project TestBuildCmd.xcodeproj -scheme TestBuildCmd -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6' build

Update 更新

The above example command will build a binary including the graphics for iPhone 6 only. 上面的示例命令将构建一个二进制文件,仅包含iPhone 6的图形。 If the binary is run on other simulators, the iPhone 6 graphics is scaled to the platform. 如果二进制文件在其他模拟器上运行,则iPhone 6图形将缩放到平台。 A better workaround which contains all graphics for all platforms is to specify the parameter PLATFORM_NAME=iphonesimulator , for example: 包含所有平台的所有图形的更好的解决方法是指定参数PLATFORM_NAME=iphonesimulator ,例如:

xcodebuild -project TestBuildCmd.xcodeproj -scheme TestBuildCmd -sdk iphonesimulator -arch i386 PLATFORM_NAME=iphonesimulator build

Try removing all previous architectures (ie remove the ARCHS_STANDARD setting) at the same time as you add i386 to the Architectures. 尝试删除所有以前的体系结构(即删除ARCHS_STANDARD设置),同时将i386添加到体系结构中。 This should change the active architecture to i386. 这应该将活动架构更改为i386。 I encountered a similar issue when I tried to build for armv7 by default, but it kept trying to build for arm64. 我在默认情况下尝试构建armv7时遇到了类似的问题,但它一直在尝试为arm64构建。 I changed ARCHS_STANDARD to ARCHS_STANDARD_32_BIT, and this changed the active architecture chosen. 我将ARCHS_STANDARD更改为ARCHS_STANDARD_32_BIT,这改变了所选的活动架构。

In acrhiecture - sometimes to support 6.0 and 7.0 , we exlude arm64 在acrhiecture - 有时支持6.0和7.0,我们排除arm64

In architectures - > acrchitecture - select standard architecture arm64 armv7 armv7s. 在架构中 - > acrchitecture - 选择标准架构arm64 armv7 armv7s。 Just below in Valid acrchitecture make user arm64 armv7 armv7s is included. 在有效的架构下面,包括用户arm64 armv7 armv7s。 This worked for me. 这对我有用。

I solved this problem using @Kjuly's answer and the specific line: 我用@ Kjuly的答案和具体的一行解决了这个问题:

"The reason failed to build might be that, the project does not support the architecture of the device you connected." “无法构建的原因可能是,该项目不支持所连接设备的架构。”

With Xcode loaded it automatically set my iPad app to iPad Air 加载Xcode后,它会自动将我的iPad应用程序设置为iPad Air

在此输入图像描述

This caused the dependancy analysis error. 这导致了依赖性分析错误。

Changing the device type immediately solved the issue: 更改设备类型立即解决了问题:

在此输入图像描述

I don't know why this works but this is a very quick answer which saved me a lot of fiddling around in the background and instantly got the app working to test. 我不知道为什么会这样,但这是一个非常快速的答案,它让我在后台摆弄了很多东西,并立即让应用程序正在测试。 I would never have thought that this could be a thing and something so simple would fix it but in this case it did. 我永远不会想到这可能是一件事,而这么简单的东西会解决它,但在这种情况下确实如此。

I found that it was necessary to enter the architecture names by hand: 我发现有必要手工输入架构名称:

在此输入图像描述

I don't know why this was necessary, ie why these values were not inherited from Xcode itself. 我不知道为什么这是必要的,即为什么这些值不是从Xcode本身继承的。 But as soon as I did this, the problem went away. 但是一旦我这样做,问题就消失了。

In Valid architectures: Select each entry (release, debug) and build and press backspace. 在有效体系结构中:选择每个条目(发布,调试)并构建并按退格键。 It should work 它应该工作

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误“ ONLY_ACTIVE_ARCH = YES,活动arch = x86_64,VALID_ARCHS = i386” - an error “ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386” 没有要编译的架构 (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=armv7 arm64) Xcode 12 - No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=armv7 arm64) Xcode 12 没有要编译的体系结构(ONLY_ACTIVE_ARCH = YES,活动arch = armv7,VALID_ARCHS = armv6 i386) - No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=armv7, VALID_ARCHS=armv6 i386) Xcode 12 - 没有要编译的架构(ONLY_ACTIVE_ARCH=YES,active arch=x86_64,VALID_ARCHS=arm64e armv7s arm64 arm7) - Xcode 12 - No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=arm64e armv7s arm64 arm7) iPhone 5S特定错误:没有要编译的体系结构(ONLY_ACTIVE_ARCH = YES,活动arch = arm64,VALID_ARCHS = armv7 armv7s) - iPhone 5S Specific Error: No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=arm64, VALID_ARCHS=armv7 armv7s) i386体系结构和ONLY_ACTIVE_ARCH的未定义符号 - Undefined symbol for i386 architecture and ONLY_ACTIVE_ARCH 检查依赖项...没有要编译的体系结构(ARCHS = i386,VALID_ARCHS = arm64 armv7s armv7) - Check dependencies… No architectures to compile for (ARCHS=i386, VALID_ARCHS=arm64 armv7s armv7) 没有要编译的架构(ARCHS = i386,VALID_ARCHS = arm64 armv7 armv7s) - No architectures to compile for (ARCHS=i386, VALID_ARCHS=arm64 armv7 armv7s) Xcode 9没有要编译的体系结构(ARCHS = arm64,VALID_ARCHS = armv6 armv7) - Xcode 9 No architectures to compile for (ARCHS=arm64, VALID_ARCHS=armv6 armv7) 错误ITMS-9000无效的体系结构x86_64,i386 - Error ITMS-9000 Invalid Architectures x86_64, i386
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM