简体   繁体   中英

What exactly do the “Architectures” & “valid architectures” options in Xcode mean, and what should I set for iOS projects?

I work with cross platform code, which means I have to build open-source C++ projects for iOS to use them in my iOS app. Sometimes I have to build my own project, sometimes I get a nice CMake setup, but no two projects seem to have exactly the same settings for these two fields.

Some have "armv7", others "armv7 armv7s" and others "armv7 armv7s arm64". I get that "armv7" refers to a specific generation of device hardware. But does that mean if I only set "armv7" my app won't run on armv7s or the new 64bit iPad? Are these multiple architectures like having fat libraries, with separate copies for each architecture?

Then for "Architectures" there are even more options. Options like "Standard Architectures(armv7, armv7s)" and others like "$(ARCHS_STANDARD_32_64_BIT)". I often find these have to be changed to get things to build, without errors about i386. The fact an iOS project actually gets built for Intel (simulator) as well as Arm just confuses things further for me.

I'm really after a higher level explanation how this fits together than a "use this setting" answer. I want to be confident my app will work on the devices it is intended to, since I cannot afford all the different versions of iPad now in existence. For reference, I want to support iPad 2 and up, and iOS 6/7 only.

These are different instruction sets. If you're building a library, you need to build all the different instruction sets/architectures that the downstream application will require, otherwise you'll get linker errors when you try and build the app.

This is complicated by the simulator, which needs Intel x86 or x86_64 rather than ARM.

Based on what you select, the compiler will create fat libraries containing multiple architectures.

There is some compatibility between the different instruction sets at runtime (for instance, 32bit will run on 64bit ) but that won't help during linking. If you're compiling 64bit, then the libraries you're including will need 64bit.

So the short answer is set for the devices you're targeting . Eg you probably don't need armv6 any more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM