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.pswp.cn/news/444759.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/444759.shtml
英文地址,請注明出處:http://en.pswp.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…