Begin main content

Making a fat static library for iOS device and simulator

Some third party iOS library providers (I'm looking at you Omniture) provide separate static library archives for simulator (i386) and device (armv6 and or armv7).

That's a pain since you either change them manually or set the linking flags on different Xcode targets to use the appropriate library (whereas normally with libraries and frameworks you just drag it into your project and you're done).

Instead, you can build your own fat (multi-architecture) library from the provided archives and Xcode will link against the appropriate architecture segment (flagrantly ignoring Erik's dire predictions about testability and your personality ;)

We achieve this using the lipo tool, eg:

lipo -output libOmnitureAppMeasurement-fat.a -create -arch armv6 libOmnitureAppMeasurement-iPhoneDevice.a -arch l386 libOmnitureAppMeasurement-iPhoneSimulator_4_0_GM.a

Update:

The latest Omniture libraries, available via the Omiture SiteCatalyst admin console, now contains armv6 and armv7 architectures. Oddly, that means that they provide two archives—one regular i386 archive (with no fat header) for the simulator and one fat archive for the device with armv6 and armv7 segments. Since the device archive headers now specify the archives already, we don't need to tell lipo anything other than the archive file name.

lipo -output libOmnitureAppMeasurement-fat.a -create libOmnitureAppMeasurement-iPhoneDevice.a -arch i386 libOmnitureAppMeasurement-iPhoneSimulator.a

11:43 PM, 18 Nov 2010 by Mark Aufflick Permalink

Script gor generate for library

Fat library is a good solution, i use it since many month with a script inside my library project. In your project you just need add a simple "shell script target" (you can name it Universal Lib Build). And then in run script script of this target i use the following script (by replacing #variable# by the good) and then the fat library generation i automate:

script :

# shell script goes here

XCODEBUILD_PATH=/Developer/usr/bin
XCODEBUILD=$XCODEBUILD_PATH/xcodebuild

SDKROOTDIR=/Users/Shared/_BUILDS_/#LIBRARY_NAME#_SDK

echo "Start Universal #TARGET_NAME# SDK Generation"

echo "Step 1 : #TARGET_NAME# SDK Build Library for simulator and device architecture"

$XCODEBUILD -target "#TARGET_NAME#" -sdk "iphonesimulator" -configuration "Release" clean build 
$XCODEBUILD -target "#TARGET_NAME#" -sdk "iphoneos" -configuration "Release" clean build 

echo "Step 2 : Remove older SDK Directory"

rm -rf $SDKROOTDIR

echo "Step 3 : Create new SDK Directory Version"

mkdir $SDKROOTDIR
mkdir $SDKROOTDIR/build_SDK
mkdir $SDKROOTDIR/build_SDK/headers

echo "Step 4 : Create new SDK binary Version"

cp /Users/Shared/_BUILDS_/Release-iphoneos/#libraryName#.a $SDKROOTDIR/build_SDK
mv $SDKROOTDIR/build_SDK/#libraryName#.a $SDKROOTDIR/build_SDK/#libraryName#_device.a

cp /Users/Shared/_BUILDS_/Release-iphonesimulator/#libraryName#.a $SDKROOTDIR/build_SDK
mv $SDKROOTDIR/build_SDK/#libraryName#.a $SDKROOTDIR/build_SDK/#libraryName#_simulator.a

echo "Step 5 : Create combine lib files for various platforms into one"

# combine lib files for various platforms into one
lipo -create $SDKROOTDIR/build_SDK/#libraryName#_device.a $SDKROOTDIR/build_SDK/#libraryName#_simulator.a  -output $SDKROOTDIR/build_SDK/#libraryName#_SDK.a

echo "Step 6 : Copy headers Needed"
PROJECT_HOME=`pwd`
echo $PROJECT_HOME

cp $PROJECT_HOME/Classes/*.h $SDKROOTDIR/build_SDK/headers

cp $PROJECT_HOME/Classes/#otherDriectoryNeeded#/*.h $SDKROOTDIR/build_SDK/headers

echo "Step 7 : Copy other file needed like bundle"
cp -r $PROJECT_HOME/Classes/*.bundle $SDKROOTDIR/build_SDK/

echo "Step 8 : Create final SDK package"

rm -rf $SDKROOTDIR/#LibraryName#_SDK
mkdir $SDKROOTDIR/#LibraryName#_SDK
cp -r $SDKROOTDIR/build_SDK/headers $SDKROOTDIR/#LibraryName#_SDK
cp -r $SDKROOTDIR/build_SDK/*.bundle $SDKROOTDIR/#LibraryName#_SDK
cp  $SDKROOTDIR/build_SDK/#libraryName#_SDK.a $SDKROOTDIR/#LibraryName#_SDK

echo "Finish Universal #TARGET_NAME# SDK Generation"

exit 0
YD

by Unregistered Visitor on 10/06/11

yogesh

Appreciate it for your wonderful submit additionally thank you to the ones presenting all of us wonderful facts. Remember to preserve putting up. global money transfers

by Unregistered Visitor on 01/09/15

ROCK

I’m in truth surprised with your develop, this particular fantastic information every person termed such a, finest must have into your giving and as well placing whilst while on an trip to look at versions unique exclusive firm information. venta de Oximetros

by Unregistered Visitor on 01/10/15

I know exactly everything you do and Aim prepared

I know exactly everything you do and Aim prepared for that so you have to go and reviews the shocking principal this the body and if this chase knows the minister the 135 no legal 225 new MAXX TEST 300 275 I'm going to go and start now with 3:15 and I'm going to do 20 reps with 3:15 and then I'm going to go and have the guys pull off plates men have 2:25 left and then I'm going to do another 10 reps then I'm going to dig to have them to gofer another 45 from played no 1:35 left and then . http://www.x4facts.com/before-buying-maxx-test-300-read-it-first/

by Unregistered Visitor on 01/10/15

With which you normally would

With which you normally would do a fly light back at a flat bench with dumbbell in each hand elbows bent 90 degrees slowly precedent most directly MAXX TEST 300 over your chest into your arms are fully extended but lacked at this extension squeeze your picas together for two seconds then slowly return to starting position now once you reach the battle position extend the weights out to each side to your body keeping your elbows slightly bent now bring them up in a arc until they lately meet at the top then . http://www.x4facts.com/before-buying-maxx-test-300-read-it-first/

by Unregistered Visitor on 01/10/15

Spinach and then lastly

Spinach and then lastly this his plants has South different choose from reaction cared ready to go sap area all scare you as a pop exact all yes setting here yes okay quest three last questions yes home Scott shot thank you guys. MAXX TEST 300 SO much for the amazing nice guard workouts me your plans really do make a difference working out how's about their star for 30 min at work day all their actual size work Watergate. Fore More Information >>>>>>>>> http://www.x4facts.com/before-buying-maxx-test-300-read-it-first/

by Unregistered Visitor on 01/10/15

But in the meantime take this

But in the meantime take this directly to blocker you know aceinhibitor does this do they usually give say you should lose weight sometime by here take this drug right away okayso is drug first when your body requires itself selfregulate your body requires blood pressure this hype for whatever reason you chemically lowerit know the body needs it up there right sowhat's gonna happen is the body dumped court is all into the system now theprimary role Accord is also a stress hormone it's down regulate insulin receptors . MAXX TEST 300 This mean blood sugar goes up the reason is your your liver's gottadump energy back into the blood because for some stupid reason your blood pressure is too low okay soit dumps a back up there now this is called Cushing syndrome itsexcess cortisol where's the fat distribution on thisBilly seemed nice why because your body has stresshormones which causes abnormal distribution our blood supply to the guy this meansyou can break down new transit camp read and nutrients what do you do . For more information check this site >>>>http://www.x4facts.com/before-buying-maxx-test-300-read-it-first/

by Unregistered Visitor on 01/10/15

If you absorb calcium better from

If you absorb calcium better from your food it will end up in your urine so effectively what this is saying the more vitamin D you have the more calcium you get into your urine which is good but once the level exceeds. MAXX TEST 300 Wighty in our case now no more spring leader there was a stable range that means you’ve got enough vitamin D to properly control the vitamin D hormone message to absorb calcium and once we started exceeding that 209 15 animal print leader range the non physiologic range indeed there was again a statistical rise in serum calcium the point of this figure is if that canary in the mine is your signal to tell you when there is potential risk of harm that signal triggers at about 215 an almost spring leader. http://www.x4facts.com/before-buying-maxx-test-300-read-it-first/

by Unregistered Visitor on 01/10/15

Software and Drivers Download

I had been very impressed by this post, this site happens to be pleasant news Thanks very much for this interesting post, and I meet them more often then I visited this web site. SOFTWARE AND DRIVERS DOWNLOAD DRIVERS DOWNLOAD

by Unregistered Visitor on 01/17/15

Darrin

I used to have issues while submitting my work online since I was not 100% sure that it was all good. Now, thanks to you and your bogs, I am confident with my online work. I now proofread online on kettyediting.com before I submit it.

by Unregistered Visitor on 01/19/15

Edu

The purpose of education is just not to create students alternatively individuals. The students are inside fresh variety once they acquire entry inside institution or including I write my essay for me on site grabmyessayonline.com mannered company. Is it doesn't obligation of institution management in order to change that fresh natural talent inside far too precious for your contemporary society.

by Unregistered Visitor on 01/20/15

Rachel

Once basketball is discovered, that hoop is actually an important basket, for that reason the company name basketball. As time began, the important backboard turned out to be bigger, although rules developed, the net sale was applied. www.scorespro.com

by Unregistered Visitor on 01/23/15

Edu

Education tells you regarding turmoil resolution. Which implies training offers you several method which http://ineedessayhelp.com/write-my-essay an individual perform incorrect other people. We need to always be hearing and to manufacture strength to take determination.

by Unregistered Visitor on 01/24/15

Add comment