Http://lanvige.github.io/2014/03/19/architecturs-in-xcode/
After the upgrade of xcode 5.1, it took a day for arm64 and cocoapods to solve the problem and recorded the learning results.
Armv6/7/7 S & arm64
Before learning about architecture, let's first get to know these names. Armv6, armv7, armv7s, and arm64 are different instruction sets of the arm cpu, just like the software versions that sneak into the CPU. The iPhone processor model is A4, A8...
| Arm chip |
IPhone models |
| Armv6 |
IPhone, iPhone E2, iPhone 3G |
| Armv7 |
IPhone 3gs, iPhone 4, iPhone 4S |
| Armv7s |
IPhone 5 |
| Arm64 |
IPhone 5S |
Commands are backward compatible. For example, the iPhone 5S CPU supports arm64, but it is also compatible with armv7s. If the program uses the armv7s command for compilation, it may not be able to make full use of its 64-bit features.
Architecture refers to the target device (arm instruction set, such as armv7, armv7s…) when the program is compiled ...), During compilation, a proprietary installation package is generated for different instruction sets (devices. The instruction set corresponding to the device is executed on different devices. For example, the arm64 command is executed for iPhone 5s (if any)
Xcode Configuration
You can manually add the preceding values in the ubuntures settings of target to add or delete the feature instruction set. To facilitate the use of command combinations, xcode defines some variables. However, these variables have different values in different xcode versions.
$(ARCHS_STANDARD)
This is the default value of architecture in xcode. In xcode5, this value is armv7 and armv7s. In xcode 5.1, the compilation of arm64 is mandatory. Therefore, this value is armv7 and armv7s, arm64.
$(ARCHS_STANDARD_32_BIT)
Both xcode 5 and 5.1 arearmv7, armv7sIn the old version, onlyarmv7.
$(ARCHS_STANDARD_INCLUDING_64_BIT)
Both xcode 5 and 5.1 arearmv7, armv7s, arm64
If the architecture set in the program is armv7, when the iPhone 5 real machine debug is used, "XXXX does not contain a (n) armv7s slice: XXXXX for architecture armv7s "compilation error. To solve this problem, add armv7s to the architecture. This situation is more common in third-party open source libraries.
The support for arm64 is mandatory after xcode 5.1, but many third-party libraries are not updated, resulting in compilation errors. The solution is to delete the default architecture in xcode 5.1 and addarmv7,armv7s, Clean and then build again. After third-party libraries support arm64, you can change the value back.
After enabling the arm64 support, you cannot develop versions earlier than iOS 5.1.1. You must set deployment target to 5.1.1 or later.
Xcode 4.5 removes the support for arm6. If you want to develop an application that supports arm6, you must use the old xcode.
View
.aDatabase-supported Instruction Sets
You can use thislipoCommand to view the instruction sets supported by database..
123456 |
~/Library/Developer/Xcode/DerivedData/xxxx/Build/Products/Debug-iphoneos$ lipo -info *.aArchitectures in the fat file: libPods-AFNetworking.a are: armv7 armv7sArchitectures in the fat file: libPods.a are: armv7 armv7s
|
Active architecture
Ubuntu has a bool-type configuration item calledBuild Active Architecture Only.
- Yes indicates that only the packages of the corresponding instruction set are compiled for the target device. The installation package is small, but only for the instruction set device;
- No, the compiler will integrate two instruction sets. The generated installation package is large, but it can be installed and run on different devices.
In general, select Yes for "build active architecture only" in debug mode, and check whether the code logic is faulty with the current architecture. In release mode, select no to adapt to different devices.
In addition, if the simulator does not run arm code, the software will be compiled into instructions that can be run on x86. Therefore, when a static library is generated, both of them are generated. a. The i386 is used to run on the simulator, and the other is run on the real device. Then, run the two commands. a.
Cocoapods and architecture
When a pod project is generated in cocoapods, the target architecture configuration of the pod package is configured according to the configuration in the current project. The following text prompt is displayed.
[!] Found multiple values (‘armv7’, ‘armv7s’) for the architectures (‘ARCHS’) build setting for the ‘Pods’ target definition. Using the first.
That is, if there are multiple configurations, it will only set the target of all the packages to the first one (for example, the architecture configured in origin projectg isarmv7&armv7sWhen there are two items, onlyarmv7One item ).
For the 64-Bit Error in xcode 5.1, use$(ARCHS_STANDARD_32_BIT)Replace the default$(ARCHS_STANDARD)This problem can be avoided.
Automatically select Architecture
Ref ::
Posted by lanvige Jiang Mar 19th, 2014 IOS