Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS simulator on mac is running i386 architecture, not armv7?

I've got some static libraries I've built for use on armv7 architectures. When I try to use them in a iOS project which I testrun on the iphone 5.0 simulator, I get errors telling me about undefined symbols for architecture i386 in my static libraries.

So I guess this means the iphone simulator wants libraries compiled for i386? What is the point of the simulator then - why dosn't it emulate armv7 architecture as well?

So the only way I can test my static libraries is to connect a physical iOS device and run it?

Or did I get it wrong?

like image 673
KaiserJohaan Avatar asked Oct 24 '11 10:10

KaiserJohaan


People also ask

What architecture does iOS simulator use?

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

Is iOS simulator arm64?

Both ios-arm64-simulator and ios-x86_64-simulator represent two equivalent library definitions. Seeing these when trying to create an xcframework for Apple Silicon that supports Mac Catalyst and the iOS Simulator: Both ios-arm64-simulator and ios-x86_64-simulator represent two equivalent library definitions.

How do I enable simulator on Mac?

The basic way to open a list of simulators is to use Xcode -> Window -> Devices and Simulators. Here you can create and manage all available simulators. But you cannot run them directly. You need to build your application on the simulator, and then you can run it.


3 Answers

So I guess this means the iphone simulator wants libraries compiled for i386? What is the point of the simulator then - why dosn't it emulate armv7 architecture as well?

You've answered your own question. It's a simulator, not an emulator. Therefore it is a Mac OSX program, running on i386 architecture. If you compile your static libraries for i386 as well you will be able to use them on the simulator.

like image 86
jrturton Avatar answered Oct 11 '22 13:10

jrturton


I am not very sure but i386 is for Simulator and armv7 is for Devices that you have connected to your Machine.

like image 9
mAc Avatar answered Oct 11 '22 13:10

mAc


You can actually compile the app through Xcode command line tool using i386 architecture (there is also a way to run it in Xcode UI by modifying the build settings).

xcodebuild -sdk iphonesimulator6.1 -arch i386 VALID_ARCHS="i386 armv7 armv7s" clean install

Run this command in the directory that you have the projectName.xcodeproj file.

Here's a break down of the script:

-sdk iphonesimulator6.1 // Build the app on iPhone simulator 6.1
-arch i386 // Build your app using i386 architecture
VALID_ARCHS="i386 armv7 armv7s" // Specify these architectures are valid
clean install // Clean all the builds then re-build and install
like image 4
Jingjie Zhan Avatar answered Oct 11 '22 11:10

Jingjie Zhan