Universal Library with both Simulator and iOS Architectures

Just a quick note to myself, because today I had to dig out from my brain, how it was I once built a Mach-O Universal library with both Simulator (i386) architecture and iOS (armv6+7) architectures in it.

xcodebuild -configuration Release -target my -sdk iphonesimulator4.0 clean build
xcodebuild -configuration Release -target my -sdk iphoneos4.3 clean build
lipo -create -output build/libmy.a build/Release-iphonesimulator/libmy.a build/Release-iphoneos/libmy.a

The final fat library created by “lipo” can now be used to link both Simulator and iOS builds.

When you construct the above lines for your project, a couple of xcodebuild commands that list info about a given xcode project, might come in handy:

xcodebuild -list yourProjectName
xcodebuild -showsdks

Where “-list” list information like “targets” and “build configurations” about given project and “-showsdks” shows the possible sdk names to use.

August 22, 2011 В· polesen В· No Comments
Tags: ,  В· Posted in: Programming, Tools

Leave a Reply