Xcode的Architectures和Valid Architectures的区别

 

目录[-]

  • Xcode的Architectures和Valid Architectures的区别
  • Architectures
  • Valid Architectures
  • 原因解释如下:
  • 参考1:
  • 所有IOS设备详情列表 List of iOS devices - Wikipedia, the free encyclopedia
  • 参考2:
  • iOS 7: 如何为iPhone 5S编译64位应用。
  • 参考3:
  • What's the difference between “Architectures” and “Valid Architectures” in Xcode Build Settings?
  • 参考4:
  • Xcode 5 and iOS 7: Architecture and Valid architectures
  • 参考5:
  • how to stop xcode5.1 building for 64bit
  • 参考6:
  • 1. Xcode Build Setting Reference (苹果官方文档)
  • 2. 64-Bit transition Guide for Cocoa Touch (苹果官方文档)
  • 3. Xcode设置项之Architectures和Valid Architectures

作者:shede333 
主页:http://my.oschina.net/shede333 
版权声明:原创文章,版权声明:自由转载-非商用-非衍生-保持署名 | Creative Commons BY-NC-ND 3.0


Xcode的Architectures和Valid Architectures的区别

Architectures

这代表,在这个项目里你想要Xcode编译的目标设备列表。

Valid Architectures

还不是太明确这个设置的意图,但是一般来说是不需要更改的。


在Xcode5.0里的Valid Architectures 设置里,有2个选项:

  1. 默认为standard architectures (including 64-bit)(armv7,armv7s,arm64),这样设置,你的Deployment target最低只能设置为 6.0,(在Xcode5.0.1 之后,最低能够兼容IOS 5.1.1);
  2. standard architectures (armv7,armv7s),这样设置,你的Deployment target最低能设置为 4.3;

原因解释如下:

使用standard architectures (including 64-bit)(armv7,armv7s,arm64)参数, 
则打的包里面有32位、64位两份代码, 
在iPhone5s(iPhone5s的cpu是64位的)下,会首选运行64位代码包, 
其余的iPhone(其余iPhone都是32位的,iPhone5c也是32位), 
只能运行32位包, 
但是包含两种架构的代码包,只有运行在ios6,ios7系统上。 
这也就是说,这种打包方式,对手机几乎没啥要求,但是对系统有要求,即ios6以上。

而使用standard architectures (armv7,armv7s)参数, 
则打的包里只有32位代码, 
iPhone5s的cpu是64位,但是可以兼容32位代码,即可以运行32位代码。但是这会降低iPhone5s的性能,原因下面的参考有解释。 
其余的iPhone对32位代码包更没问题, 
而32位代码包,对系统也几乎也没什么限制。

所以总结如下: 
要发挥iPhone5s的64位性能,就要包含64位包,那么系统最低要求为ios6。 
如果要兼容ios5以及更低的系统,只能打32位的包,系统都能通用,但是会丧失iPhone5s的性能。


参考1:

所有IOS设备详情列表 List of iOS devices - Wikipedia, the free encyclopedia

armv6:iPhone 2G/3G,iPod 1G/2G 
armv7:iPhone 3GS/4/4s,iPod 3G/4G,iPad 1G/2G/3G ,iPad Mini 1 
armv7s:iPhone5 ,iPhone5C ,iPad4 
armv8:iPhone5S ,iPad5(iPad Air), iPad Mini 2(iPad Mini Retina)


参考2:

iOS 7: 如何为iPhone 5S编译64位应用。

Xcode 5编译的iOS 7程序包含了32位和64位两套二进制代码,在32位的iOS系统上会调用32位的二进制代码,在64位系统上会调用64位的二进制代码,以此来解决向后兼容的问题。

同时,考虑到很多32位的程序可能在没有重新编译的情况下部署到64位系统上,64位的iOS系统中带有两套FrameWork,一套是32位的,一套是64位的。 
当64位的iOS系统运行原来的32位程序时,系统会调用32位的FrameWork作为底层支撑,当系统运行64位程序时,系统会调用64位的FrameWork作为底层支撑。

也就是说,当一个iPhone 5S上同时运行32位程序和64位程序时,系统同时将32位和64位两套FrameWork载入了内存中,所以消耗的内存也比较多。

如果一台64位的iOS设备上运行的所有程序都是为64位系统编译过的,iOS系统将只载入64位的FrameWork,这将节省好多内存。所以,如果大家都可以快速将程序传换成64位的,iOS将跑得更快。真的是“大家好才是真的好”。


参考3:

What's the difference between “Architectures” and “Valid Architectures” in Xcode Build Settings?

Architectures are the ones you want to build, valid architectures are the ones you could conceive of building with your codebase.

So maybe you only want to build your binary for armv7s, but the same source code would compile fine for armv7 and armv6. So VALID_ARCHS = armv6 armv7 armv7s, but you set ARCHS = armv7s because that's all you actually want to build with your code.

Or, in Apple-ese:

ARCHS (Architectures)

Space-separated list of identifiers. Specifies the architectures (ABIs, processor models) to which the binary is targeted. When this build setting specifies more than one architecture, the generated binary may contain object code for each of the specified architectures.

and:

VALID_ARCHS (Valid Architectures)

Space-separated list of identifiers. Specifies the architectures for which the binary may be built. During the build, this list is intersected with the value of ARCHS build setting; the resulting list specifies the architectures the binary can run on. If the resulting architecture list is empty, the target generates no binary.

Source: Xcode Build Setting Reference

In practice, you leave VALID_ARCHS alone and don't worry about changing it, and just fiddle with ARCHSto set the architectures you want to build. Typically, you set a Debug build to just NATIVE_ARCH, since you only want to build the debug version for the machine you'll be testing/running it on, and Release builds for the full spectrum of architectures you plan to support.


参考4:

Xcode 5 and iOS 7: Architecture and Valid architectures

Set the architecture in build setting to Standard architectures(armv7,armv7s)

enter image description here

iPhone 5S is powered by A7 64bit processor. From apple docs

Xcode can build your app with both 32-bit and 64-bit binaries included. This combined binary requires a minimum deployment target of iOS 7 or later.

Note: A future version of Xcode will let you create a single app that supports the 32-bit runtime on iOS 6 and later, and that supports the 64-bit runtime on iOS 7.

From the documentation what i understood is

  • Xcode can create both 64bit 32bit binaries for a single app but the 
    deployment target should be iOS7. They are saying in future it will 
    be iOS 6.0
  • 32 bit binary will work fine in iPhone 5S(64 bit processor).

Update (Xcode 5.0.1) 
In Xcode 5.0.1 they added the support to create 64 bit binary for iOS 5.1.1 onwards.

Xcode 5.0.1 can build your app with both 32-bit and 64-bit binaries included. This combined binary requires a minimum deployment target of iOS 5.1.1 or later. The 64-bit binary runs only on 64-bit devices running iOS 7.0.3 and later.

Update (Xcode 5.1) 
Xcode 5.1 made significant change in the architecture section. This answer will be a followup for you. 
Check this


参考5:

how to stop xcode5.1 building for 64bit

OP is posted the solution along with the question itself. But I feel it would be better to add it as an answer. In Xcode 5.1 apple made significant changes to the architecture section. They made arm64 as part of Standard architectures. That means the projects using the default setting will be automatically build for arm64 also. So what you will do if your app does not support arm64?.

Doc says:

Projects not able to support 64-bit need to specifically set the architectures build setting to not include 64-bit.

How to do that?

  1. Goto Targets–>Build Settings–>Architectures–>Architectures

  2. Double click on the architecture will popup a menu. Choose others

    enter image description here

  3. Delete the existing row - $(ARCH_STANDARD). Add the required architectures one by one

    enter image description here

  4. Now your architecture section will look like this

    enter image description here


参考6:

1. Xcode Build Setting Reference (苹果官方文档)

2. 64-Bit transition Guide for Cocoa Touch (苹果官方文档)

3. Xcode设置项之Architectures和Valid Architectures

目录[-]

  • Xcode的Architectures和Valid Architectures的区别
  • Architectures
  • Valid Architectures
  • 原因解释如下:
  • 参考1:
  • 所有IOS设备详情列表 List of iOS devices - Wikipedia, the free encyclopedia
  • 参考2:
  • iOS 7: 如何为iPhone 5S编译64位应用。
  • 参考3:
  • What's the difference between “Architectures” and “Valid Architectures” in Xcode Build Settings?
  • 参考4:
  • Xcode 5 and iOS 7: Architecture and Valid architectures
  • 参考5:
  • how to stop xcode5.1 building for 64bit
  • 参考6:
  • 1. Xcode Build Setting Reference (苹果官方文档)
  • 2. 64-Bit transition Guide for Cocoa Touch (苹果官方文档)
  • 3. Xcode设置项之Architectures和Valid Architectures

作者:shede333 
主页:http://my.oschina.net/shede333 
版权声明:原创文章,版权声明:自由转载-非商用-非衍生-保持署名 | Creative Commons BY-NC-ND 3.0


Xcode的Architectures和Valid Architectures的区别

Architectures

这代表,在这个项目里你想要Xcode编译的目标设备列表。

Valid Architectures

还不是太明确这个设置的意图,但是一般来说是不需要更改的。


在Xcode5.0里的Valid Architectures 设置里,有2个选项:

  1. 默认为standard architectures (including 64-bit)(armv7,armv7s,arm64),这样设置,你的Deployment target最低只能设置为 6.0,(在Xcode5.0.1 之后,最低能够兼容IOS 5.1.1);
  2. standard architectures (armv7,armv7s),这样设置,你的Deployment target最低能设置为 4.3;

原因解释如下:

使用standard architectures (including 64-bit)(armv7,armv7s,arm64)参数, 
则打的包里面有32位、64位两份代码, 
在iPhone5s(iPhone5s的cpu是64位的)下,会首选运行64位代码包, 
其余的iPhone(其余iPhone都是32位的,iPhone5c也是32位), 
只能运行32位包, 
但是包含两种架构的代码包,只有运行在ios6,ios7系统上。 
这也就是说,这种打包方式,对手机几乎没啥要求,但是对系统有要求,即ios6以上。

而使用standard architectures (armv7,armv7s)参数, 
则打的包里只有32位代码, 
iPhone5s的cpu是64位,但是可以兼容32位代码,即可以运行32位代码。但是这会降低iPhone5s的性能,原因下面的参考有解释。 
其余的iPhone对32位代码包更没问题, 
而32位代码包,对系统也几乎也没什么限制。

所以总结如下: 
要发挥iPhone5s的64位性能,就要包含64位包,那么系统最低要求为ios6。 
如果要兼容ios5以及更低的系统,只能打32位的包,系统都能通用,但是会丧失iPhone5s的性能。


参考1:

所有IOS设备详情列表 List of iOS devices - Wikipedia, the free encyclopedia

armv6:iPhone 2G/3G,iPod 1G/2G 
armv7:iPhone 3GS/4/4s,iPod 3G/4G,iPad 1G/2G/3G ,iPad Mini 1 
armv7s:iPhone5 ,iPhone5C ,iPad4 
armv8:iPhone5S ,iPad5(iPad Air), iPad Mini 2(iPad Mini Retina)


参考2:

iOS 7: 如何为iPhone 5S编译64位应用。

Xcode 5编译的iOS 7程序包含了32位和64位两套二进制代码,在32位的iOS系统上会调用32位的二进制代码,在64位系统上会调用64位的二进制代码,以此来解决向后兼容的问题。

同时,考虑到很多32位的程序可能在没有重新编译的情况下部署到64位系统上,64位的iOS系统中带有两套FrameWork,一套是32位的,一套是64位的。 
当64位的iOS系统运行原来的32位程序时,系统会调用32位的FrameWork作为底层支撑,当系统运行64位程序时,系统会调用64位的FrameWork作为底层支撑。

也就是说,当一个iPhone 5S上同时运行32位程序和64位程序时,系统同时将32位和64位两套FrameWork载入了内存中,所以消耗的内存也比较多。

如果一台64位的iOS设备上运行的所有程序都是为64位系统编译过的,iOS系统将只载入64位的FrameWork,这将节省好多内存。所以,如果大家都可以快速将程序传换成64位的,iOS将跑得更快。真的是“大家好才是真的好”。


参考3:

What's the difference between “Architectures” and “Valid Architectures” in Xcode Build Settings?

Architectures are the ones you want to build, valid architectures are the ones you could conceive of building with your codebase.

So maybe you only want to build your binary for armv7s, but the same source code would compile fine for armv7 and armv6. So VALID_ARCHS = armv6 armv7 armv7s, but you set ARCHS = armv7s because that's all you actually want to build with your code.

Or, in Apple-ese:

ARCHS (Architectures)

Space-separated list of identifiers. Specifies the architectures (ABIs, processor models) to which the binary is targeted. When this build setting specifies more than one architecture, the generated binary may contain object code for each of the specified architectures.

and:

VALID_ARCHS (Valid Architectures)

Space-separated list of identifiers. Specifies the architectures for which the binary may be built. During the build, this list is intersected with the value of ARCHS build setting; the resulting list specifies the architectures the binary can run on. If the resulting architecture list is empty, the target generates no binary.

Source: Xcode Build Setting Reference

In practice, you leave VALID_ARCHS alone and don't worry about changing it, and just fiddle with ARCHSto set the architectures you want to build. Typically, you set a Debug build to just NATIVE_ARCH, since you only want to build the debug version for the machine you'll be testing/running it on, and Release builds for the full spectrum of architectures you plan to support.


参考4:

Xcode 5 and iOS 7: Architecture and Valid architectures

Set the architecture in build setting to Standard architectures(armv7,armv7s)

enter image description here

iPhone 5S is powered by A7 64bit processor. From apple docs

Xcode can build your app with both 32-bit and 64-bit binaries included. This combined binary requires a minimum deployment target of iOS 7 or later.

Note: A future version of Xcode will let you create a single app that supports the 32-bit runtime on iOS 6 and later, and that supports the 64-bit runtime on iOS 7.

From the documentation what i understood is

  • Xcode can create both 64bit 32bit binaries for a single app but the 
    deployment target should be iOS7. They are saying in future it will 
    be iOS 6.0
  • 32 bit binary will work fine in iPhone 5S(64 bit processor).

Update (Xcode 5.0.1) 
In Xcode 5.0.1 they added the support to create 64 bit binary for iOS 5.1.1 onwards.

Xcode 5.0.1 can build your app with both 32-bit and 64-bit binaries included. This combined binary requires a minimum deployment target of iOS 5.1.1 or later. The 64-bit binary runs only on 64-bit devices running iOS 7.0.3 and later.

Update (Xcode 5.1) 
Xcode 5.1 made significant change in the architecture section. This answer will be a followup for you. 
Check this


参考5:

how to stop xcode5.1 building for 64bit

OP is posted the solution along with the question itself. But I feel it would be better to add it as an answer. In Xcode 5.1 apple made significant changes to the architecture section. They made arm64 as part of Standard architectures. That means the projects using the default setting will be automatically build for arm64 also. So what you will do if your app does not support arm64?.

Doc says:

Projects not able to support 64-bit need to specifically set the architectures build setting to not include 64-bit.

How to do that?

  1. Goto Targets–>Build Settings–>Architectures–>Architectures

  2. Double click on the architecture will popup a menu. Choose others

    enter image description here

  3. Delete the existing row - $(ARCH_STANDARD). Add the required architectures one by one

    enter image description here

  4. Now your architecture section will look like this

    enter image description here


参考6:

1. Xcode Build Setting Reference (苹果官方文档)

2. 64-Bit transition Guide for Cocoa Touch (苹果官方文档)

3. Xcode设置项之Architectures和Valid Architectures

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/444759.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Python模块(8)-sklearn 简易使用教程

sklearn 简易使用教程1.scikit-learn的数据集2.scikit-learn 的训练和预测scikit-learn 是在Numpy,SciPy,Matplotlib三个模块上编写的,数据挖掘和数据分析的一个简单有效的工具。scikit-learn包括6大功能:分类,回归,聚类&#xff…

如何发布GAE的应用(一)

安装googleSDK的环境: 1 下载安装包从官网下载 https://cloud.google.com/sdk/downloads -> https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-170.0.0-windows-x86_64-bundled-python.zip 2 如果本地安装了python,直…

leetcode887 鸡蛋掉落

你将获得 K 个鸡蛋&#xff0c;并可以使用一栋从 1 到 N 共有 N 层楼的建筑。 每个蛋的功能都是一样的&#xff0c;如果一个蛋碎了&#xff0c;你就不能再把它掉下去。 你知道存在楼层 F &#xff0c;满足 0 < F < N 任何从高于 F 的楼层落下的鸡蛋都会碎&#xff0c;…

Docker 的日志相关整理

1 Docker daemon日志的位置 Docker daemon日志的位置&#xff0c;根据系统不同各不相同。 Ubuntu - /var/log/upstart/docker.logBoot2Docker - /var/log/docker.logDebian GNU/Linux - /var/log/daemon.logCentOS - /var/log/daemon.log | grep dockerFedora - journalctl -u…

PaperNotes(15)-图神经网络、PyG极简版入门笔记

图神经网络概况1.GNN,GCN,GE的区别2.图卷积的通式--矩阵该如何作用2.1实现12.2实现22.3实现33.PyTorch geometric3.1 PyG内置数据集3.1.1ENZYMES dataset3.1.2Cora3.2 PyG自定义数据集3.2.1Data构建简单的图结构3.2.2 Dataset3.2.3 InMemoryDataset一文读懂图卷积GCN(https://z…

leetcode76 最小覆盖子串

给你一个字符串 S、一个字符串 T&#xff0c;请在字符串 S 里面找出&#xff1a;包含 T 所有字母的最小子串。 示例&#xff1a; 输入: S "ADOBECODEBANC", T "ABC" 输出: "BANC" 说明&#xff1a; 如果 S 中不存这样的子串&#xff0c;则返…

Unity的匹配系统

这个匹配系统是指一个玩家&#xff0c;可以创建一个自己随意命名的房间&#xff0c;然后其他玩家可以通过联网去搜索房间&#xff0c;然后加入房间一起游戏 我先讲讲怎么使用这个匹配系统&#xff1a; 在运行游戏后&#xff0c;因为添加了Network Manager HUD组件&#xff0c;所…

PaperNotes(16)-图神经网络GNN简史、不动点建模-笔记

图神经网络简史、简介1.图神经网络简史2.图神经网络--学习过程3.图神经网络--理论基础4.图神经网络的局限5.GNN,RNN,GGNN6.小结阅读笔记&#xff1a;从图(Graph)到图卷积(Graph Convolution)&#xff1a;漫谈图神经网络模型 (一)(https://www.cnblogs.com/SivilTaram/p/graph_n…

Matchmaker

Unity的多玩家网络功能包含了玩家在因特网上互相玩而不需要公共IP地址的服务。用户可以创建游戏,获取活动游戏列表;加入并退出游戏。当在internet上玩时,网络流量将通过云中的Unity,而不是直接在客户端之间进行。这就避免了防火墙和NATs的问题,几乎可以在任何地方玩游戏。 …

PaperNotes(17)-图卷积神经网络GCN-笔记

图卷积神经网络GCN-笔记1.卷积是什么2.图卷积的源起3.空域卷积3.1消息传递网络MPNN3.2 图采样与聚合GraphSage4.频域卷积5.图结构的序列化-Patch-SAN从图(Graph)到图卷积(Graph Convolution)&#xff1a;漫谈图神经网络模型 (二)(https://www.cnblogs.com/SivilTaram/p/graph_n…

Servlet 工程 web.xml 中的 servlet 和 servlet-mapping 标签

摘录某个工程的 web.xml 文件片段&#xff1a;访问顺序为1—>2—>3—>4&#xff0c;其中2和3的值必须相同。 url-pattern 标签中的值是要在浏览器地址栏中输入的 url&#xff0c;可以自己命名&#xff0c;这个 url 访问名为 servlet-name 中值的 servlet&#xff0c;两…

leetcode236 二叉树的最近公共祖先

给定一个二叉树, 找到该树中两个指定节点的最近公共祖先。 百度百科中最近公共祖先的定义为&#xff1a;“对于有根树 T 的两个结点 p、q&#xff0c;最近公共祖先表示为一个结点 x&#xff0c;满足 x 是 p、q 的祖先且 x 的深度尽可能大&#xff08;一个节点也可以是它自己的…

Unity的 UNet组件介绍

UNet常见概念简介 Spawn:简单来说,把服务器上的GameObject,根据上面的NetworkIdentity组件找到对应监视连接,在监视连接里生成相应的GameObject.Command:客户端调用,服务器执行,这样客户端调用的参数必需要UNet可以序列化,这样服务器在执行时才能把参数反序列化。需要注意…

MachineLearning(10)-聚类

聚类1.K-mean2.系统聚类3.DBSCAN聚类算法聚类&#xff1a;无监督学习&#xff0c;将相似的样本聚为一类。核心如何定义相似。分类&#xff1a;有监督学习&#xff0c;依据分类准则&#xff0c;将样本划分为不同的类。核心分类器的设计&#xff08;KNN&#xff09;聚类&#xff…

帧同步和状态同步(一)

帧同步 什么是帧同步&#xff1a;帧同步常被RTS(即时战略)游戏常采用。在游戏中同步的是玩家的操作指令&#xff0c;操作指令包含当前的帧索引。一般的流程是客户端上传操作到服务器&#xff0c; 服务器收到后并不计算游戏行为&#xff0c; 而是转发到所有客户端。这里最重要的…

帧同步和状态同步(二)案例分析

转自&#xff1a;http://www.gameres.com/489361.html 腾讯一下出了两款MOBA游戏&#xff0c;全民超神&#xff0c;王者荣耀&#xff0c;玩了一下&#xff0c;效果不错&#xff0c;就分析了一下它底层的一些技术&#xff0c;发现一个是采用的状态同步&#xff0c;TCP协议&#…

leetcode279 完全平方数

给定正整数 n&#xff0c;找到若干个完全平方数&#xff08;比如 1, 4, 9, 16, ...&#xff09;使得它们的和等于 n。你需要让组成和的完全平方数的个数最少。 示例 1: 输入: n 12 输出: 3 解释: 12 4 4 4. 示例 2: 输入: n 13 输出: 2 解释: 13 4 9. 思路&#xf…

推荐系统(1)-概述

推荐系统概述1.数据部分2.模型部分2.1模型的组成2.2模型的训练2.3模型评估《深度学习/推荐系统》读书笔记推荐系统要处理的问题&#xff1a;对于用户U(user)&#xff0c;在特定的场景C(context)&#xff0c;针对海量的“物品信息”&#xff0c;构建一个模型f(U,I,C)f(U,I,C)f(U…

(十七)深入浅出TCPIP之UDP打洞原理

专栏其他文章: 理论篇: (一)深入浅出TCPIP之理解TCP报文格式和交互流程 (二)深入浅出TCPIP之再识TCP,理解TCP三次握手(上) (三)深入浅出TCPIP之再识TCP,理解TCP四次挥手(上) (四)深入浅出TCPIP之TCP三次握手和四次挥手(下)的抓包分析 (五)深入浅出TCPIP之TCP流…

leetcode240. 搜索二维矩阵 II

编写一个高效的算法来搜索 m x n 矩阵 matrix 中的一个目标值 target。该矩阵具有以下特性&#xff1a; 每行的元素从左到右升序排列。 每列的元素从上到下升序排列。 示例: 现有矩阵 matrix 如下&#xff1a; [ [1, 4, 7, 11, 15], [2, 5, 8, 12, 19], [3, 6…