当前位置:网站首页>Undefined symbols for architecture arm64解决方案
Undefined symbols for architecture arm64解决方案
2022-08-05 08:45:00 【今人不见古时月,今月曾经照古人】
在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》
5、Xcode设置项之Architectures和Valid Architectures
6、Xcode Build Settings中的Architecture概述
————————————————
转载于:https://blog.csdn.net/zuoyou1314/article/details/46638073
边栏推荐
- D2--FPGA SPI interface communication2022-08-03
- The Secrets of the Six-Year Team Leader | The Eight Most Important Soft Skills of Programmers
- 512-color chromatogram
- Ethernet Principle
- [Structure internal power practice] Structure memory alignment (1)
- RedisTemplate: error template not initialized; call afterPropertiesSet() before using it
- JS语法使用
- 学习笔记14--机器学习在局部路径规划中的应用
- DataFrame insert row and column at specified position
- EA谈单机游戏:仍是产品组合中极其重要的部分
猜你喜欢
Redis实现分布式锁-原理-问题详解
php向mysql写入数据失败
MySQL database error The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid)
ps怎么替换颜色,自学ps软件photoshop2022,ps一张图片的一种颜色全部替换成另外一种颜色
数据源对象管理Druid和c3p0
DataFrame在指定位置插入行和列
How to replace colors in ps, self-study ps software photoshop2022, replace one color of a picture in ps with another color
力扣刷题八月第一天
Thinking and summary of the efficiency of IT R&D/development process specification
Fiddler tool explanation
随机推荐
“充钱”也难治快手的“亏亏亏”?
Redis缓存以及存在的问题--缓存穿透、缓存雪崩、缓存击穿及解决方法
[NOIP2010 提高组] 机器翻译
苹果官网商店新上架Mophie系列Powerstation Pro、GaN充电头等产品
全面讲解GET 和 POST请求的本质区别是什么?原来我一直理解错了
控制器-----controller
nn.unfold和nn.fold
Spark cluster deployment (third bullet)
What is the connection and difference between software system testing and acceptance testing? Professional software testing solution recommendation
按钮上显示值的轮流切换
routing----router
MM上街前的折腾(有趣)
JS语法使用
Why is pnpm hitting npm and yarn dimensionality reduction?
树状数组模版+例题
[Structure internal power practice] Structure memory alignment (1)
复现一次循环和两次循环
Ethernet Principle
吴恩达深度学习deeplearning.ai——第一门课:神经网络与深度学习——第二节:神经网络基础(下)
浅谈自动采集程序及入库