32

I'm trying to get an app running on the simulator that has had some problems doing so before. We don't have libjpeg.a built for i386, but it does have x86_64. This is the only dependency left, but I'm wondering why I actually need i386 symbols, if I'm running on an x86_64 mac.

Syed Ali Salman
  • 2,894
  • 4
  • 33
  • 48
Joey Carson
  • 2,973
  • 7
  • 36
  • 60

4 Answers4

41

The iOS simulator can run your app in 32 and 64-bit modes. This allows you to work out a lot of 64-bit issues and make sure it is ready for both armv7 and arm64. To do this, it compiles your app for i386 and x86_64 and requires the libraries for both architectures.

Pradeep Reddy Kypa
  • 3,992
  • 7
  • 57
  • 75
Variable Length Coder
  • 7,958
  • 2
  • 25
  • 29
  • 2
    Thanks yes I figured this out just after posting. I was figuring that I'd at least be able to deploy to a 64 bit virtual target without 32 bit symbols and that perhaps Xcode would only attempt to link 32 bit when deploying to a 32 bit virtual target. I got around it in the meantime by just removing arm7 from the build settings. Nonetheless, you are correct and deserve the right answer. – Joey Carson Jan 19 '15 at 22:12
28

iOS apps need to run on many different architectures:

arm7: Used in the oldest iOS 7-supporting devices
arm7s: As used in iPhone 5 and 5C
arm64: For the 64-bit ARM processor in iPhone 5S
i386: For the 32-bit simulator
x86_64: Used in 64-bit simulator
Naishta
  • 11,885
  • 4
  • 72
  • 54
  • 1
    I'm aware of the different architectures. However my question was more about the particular case of why builds for both architecture were necessary simply for a simulator build. There appear to be a multitude of reasons why (e.g. your app is universal for iPad and iPhone, but Xcode SDK actually uses older 32 bit architecture to emulate older environments as they haven't been updated to 64 bit). – Joey Carson Apr 20 '17 at 17:00
9

While these days I have tried to run Fastlane to get iOS screen capture, I found the same situation:Because there is .a library contains only x86_64 architecture,but without i386 architecture,and then I got this error:

Undefined symbol(s) for architecture i386

This is running on iPhone 8 simulator with iOS 11.4.

But you can force the simulator to run on only 64-bit or only 32-bit as follows:

Project -> Architectures -> set the value as:$(ARCHS_STANDARD_32_BIT) or $(ARCHS_STANDARD_64_BIT)
ifeegoo
  • 7,054
  • 3
  • 33
  • 38
8

actually i386 architecture is for iPhone simulator where as x86_64 architecture is for iPad simulators, both are 32 and 64bit compatible.

Syed Ali Salman
  • 2,894
  • 4
  • 33
  • 48