Undefined symbols for architecture arm64解决方案
在iOS开发中经常遇到的一个错误是Undefined symbols for architecture arm64,这个错误表示工程某些地方不支持arm64指令集。那我们应该怎么解决这个问题了?我们不仅要解决这个问题,更要了解出现这个问题的根源.这样根本上杜绝这类问题发生.
对于iOS设备来说iOS的指令集有armv6、armv7、armv7s、arm64这样四种,不同型号的iOS设备使用不同的指令集,下面是各自的区别:
armv6- iPhone、iPhone 3G
- iPod 1G、iPod 2G
armv7- iPhone 3GS、iPhone 4
- iPod 3G、iPod 4G、iPod 5G
- iPad、iPad 2、iPad 3、iPad Mini
armv7s- iPhone 5、iPhone 5C
- iPad 4
arm64- iPhone 5S iPhone 6 iPhone 6Plus
- iPad Air, Retina iPad Mini
在Xcode的target->Build Settings中有一个Architectures的分组主要是用来设置Architectures方面的内容,下面重点介绍下面几个设置项的内容。
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.
Build Active Architectures Only
该编译项用于设置是否只编译当前使用的设备对应的arm指令集。
当该选项设置成YES时,你连上一个armv7指令集的设备,就算你的Valid Architectures和Architectures都设置成armv7/armv7s/arm64,还是依然只会生成一个armv7指令集的二进制包。
当然该选项起作用的前提是你的Xcode必须成功连接了调试设备。如果你没有任何活跃设备,即Xcode没有成功连接调试设备,就算该设置项设置成YES依然还会编译Valid Architectures和Architectures指定的二进制包。
通常情况下,该编译选项在Debug模式都设成YES,Release模式都设成NO。
官方文档说明:
Boolean value. Specifies whether the product includes only object code for the native architecture.
Valid Architectures
该编译项指定可能支持的指令集,该列表和Architectures列表的交集,将是Xcode最终生成二进制包所支持的指令集。
比如将Valid Architectures设置支持的arm指令集版本有:armv7、armv7s、arm64,对应的Architectures设置的支持arm指令集版本有:armv7s,这时Xcode只会生成一个armv7s指令集的二进制包。
官方文档说明:
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.
说明
1、指令集是向下兼容的。比如,armv7s指令集的设备,可以兼容运行使用armv7、armv6编译的程序。
示例
在做项目的时候,用到了第三方社交分享静态库是时候,会编译失败,先来看看下图
看,它忽略了那个静态库文件导致链接失败了,然后我查看了静态库所支持的架构,打开终端输入查看命令lipo - info xxx.a ,结果如下:
发现了这个静态库只支持armv7 armv7s i386 . 而在我的工程中Valid Architectures和Architectures中均包含了arm64的指令集,这就是说明我需要编译的app最终要支持arm64的,而程序中用到的静态库并没有arm64,所以才导致了出错,因此,需要我们去重新下载一个支持arm64的静态库文件,那么就可以正常编译通过了.
参考文档
1、《Xcode设置项之Architectures和Valid Architectures》
3、《64-Bit Transition Guide for Cocoa Touch》
Undefined symbols for architecture arm64解决方案的更多相关文章
- Undefined symbols for architecture arm64: "_OBJC_CLASS_$_WKWebView", referenced from: objc-c
出现: Undefined symbols for architecture arm64: "_OBJC_CLASS_$_WKWebView", referenced from: ...
- ios集成极光推送:Undefined symbols for architecture arm64: "_dns_parse_resource_record", referenced from:?
添加libresolv.tbd库,即可解决问题 Undefined symbols for architecture arm64: "_dns_parse_resource_record&q ...
- Undefined symbols for architecture arm64: "_OBJC_CLASS_$XXX", referenced from: objc-class-ref in XXX
ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 ...
- iOS Undefined symbols for architecture arm64解决办法
Undefined symbols for architecture arm64: "_OBJC_CLASS_$_YYCache", referenced from: ...
- Undefined symbols for architecture arm64:问题
Undefined symbols for architecture arm64: "_sqlite3_prepare_v2", referenced from: +[HMJSch ...
- iOS开发遇到的坑之一: 开发遇见如下错误:Undefined symbols for architecture arm64
博客处女作,写得不好望谅解! “for architecture arm64”就是说没有支持arm64,在Build settings里architecture相关的几项需要配置正确 在最近升级coc ...
- 解决xcode5升级后,Undefined symbols for architecture arm64:问题
The issue is that the cocoapods have not been built for arm64 architecture yet thus they cannot be l ...
- Undefined symbols for architecture arm64:
1. 没有往项目中导入静态库(.a 文件)需要的 framework. 2.拖到项目中的静态库不支持arm64(或其他)指令集 这种情况没遇到过 一般都是第一种情况.
- Undefined symbols for architecture arm64(其cpu架构)
"_OBJC_CLASS_$_XXX",referenced from: 之类的问题,很多人看到这些很头疼,不知道从何下手去修改.以下是我总结的相关修改办法.如下图 这是一个很明显 ...
随机推荐
- 开源发布:VS代码段快捷方式及可视化调试快速部署工具
前言: 很久前,我发过两篇文章,分别介绍自定义代码版和可视化调试: 1:Visual Studio 小技巧:自定义代码片断 2:自定义可视化调试工具(Microsoft.VisualStudio.De ...
- 【腾讯Bugly干货分享】Android性能优化典范——第6季
本文来自于腾讯bugly开发者社区,非经作者同意,请勿转载,原文地址:http://dev.qq.com/topic/580d91208d80e49771f0a07c 导语 这里是Android性能优 ...
- JAVA通信系列三:Netty入门总结
一.Netty学习资料 书籍<Netty In Action中文版> 对于Netty的十一个疑问http://news.cnblogs.com/n/205413/ 深入浅出Nettyhtt ...
- 好好了解一下Cookie
Cookie的诞生 由于HTTP协议是无状态的,而服务器端的业务必须是要有状态的.Cookie诞生的最初目的是为了存储web中的状态信息,以方便服务器端使用.比如判断用户是否是第一次访问网站.目前最新 ...
- 借助GitHub托管你的项目代码
PS:话说自己注册了GitHub都很久了,却没有怎么去弄,现在系统学习一下,也把自己的学习经历总结下来share给大家,希望大家都能把GitHub用起来,把你的项目代码happy地托管起来! 一.基本 ...
- 如何在 Visual Studio 中使用 Git 同步代码到 CodePlex
开源社区不管在国内还是国外都很火热,微软也曾因为没有开源而倍受指责,但是随着 .Net framework.ASP.Net MVC等框架的逐渐开源,也让大家看到了微软开源的步伐.CodePlex 则是 ...
- C# OracleDBhelper
引用 using System.Configuration;using System.Data.OracleClient; 连接字符串 <connectionStrings> <ad ...
- Vue2.0用components替换render报错
怀疑是webpack配置的问题,改了一下午也没弄好.去群里问了一轮,也没个解决的. 在研究的过程中,发现了一篇好的讨论帖,看这个帖子能学到不少东西.暂时放弃这个问题的研究了,太费时间,要深入学习编译原 ...
- 我为NET狂群福利:逆天常用的一些谷歌浏览器插件
逆天书库:http://www.cnblogs.com/dunitian/p/5734677.html 常用工具:http://www.cnblogs.com/dunitian/p/5640147.h ...
- C#:浅析结构与类的区别
一. 结构:值类型,存储在堆栈中,位于计算机的内存逻辑区域中 类 :引用类型,存储在堆中,位于计算机内存的不同逻辑位置 二. 较小的数据使用结构: 将一 ...