When is it necessary to compile for i386 on iOS

618 views Asked by At

I have recently moved to a new company and am trying to get to grips with the Xcode settings on a project. Currently the project is being compiled for "armv7 armv7s arm64 armv8 i386". Could someone please explain if is necessary to compile for i386 and why?

My project compiles ok if i remove it. One thing to note is that I am linking to a c++ lib which is compiled with the same architectures. Is i386 used for the simulator or any specific iOS devices?

Thanks

2

There are 2 answers

0
Jeremy Huddleston Sequoia On

You shouldn't need to specifically specify i386 in your architectures build setting. Ideally, you should just leave ARCHS and VALID_ARCHS as default values and everything should "just work". You will only see the arm architectures listed, but the right thing happens behind the scenes when building for the sim.

When building for the simulator, your project will be built for i386, x86_64, or both (depending on the deployment target and the ARCHS and ONLY_ACTIVE_ARCH build settings). In the simulator, 32bit devices are only allowed to run i386 code, and 64bit devices are able to run both i386 and x86_64b code (just like real devices but using intel instead of arm).

1
dandan78 On

The i386 version is needed to run your application in the iOS simulator, which runs natively on OS X and uses the underlying x86/x64 hardware. This is way faster than emulating ARM.