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

Nice post

Guar protein offer a wide selection of products for your specific requirements.
Guar korma exporter

by Unregistered Visitor on 09/17/14

The creation of the facility

The creation of the facility, cash and financial bad credit loans or credit banks and credit agencies because of the salary with the help of the developed by the desperate need for people who are very useful. it regularly no guarantor loans until the time of a payday loan credit is so named because it takes. funds will be available to regular or extra time as the other charges. see a lot of credit quick loans to finance this loan in a timely manner to emergency finance for availing. load. financial resources to implement and enforcement procedures are also a simple and no credit check loans fast: loan amount is charged by lenders to borrowers with relatively low interest best loans rates, before the sanctions.Does not require the security or collateral.

by Unregistered Visitor on 09/20/14

they look out at

they look out at your financial situation before self-control. monthly income and guaranteed payday loans amortization payments, how to manage what is going to 12 month loans happen, promising a lot of financial burdens and external affairs if you think you, it gave up on the idea of a personal loan guarantee, we no credit check loans recommend that you instead, invest wisely in the right places on a regular basis to meet the needs of loans without credit check your store, you can create a corpus. This article contains short term loans the same medicine, in order to secure the future you will help you make a wise decision, you will need to clean out all logbook loans doubts. so, here is where you want to log off by wishing the best!

by Unregistered Visitor on 09/21/14

Heating

A heat pump is an electric cooling and heating system used to compress and decompress gas to heat or cool a house. This mechanical device pumps heat from a cooler to a warmer location and can extract heat from air, water or the earth. Heating

by Unregistered Visitor on 09/22/14

For various

For various business reasons, I need a lot of Money.In addition, in order to promote growth commercial property finance and continuous work, which requires funds to maintain the smooth flow of always.in business, whether it is in urgent need of money, which continued to fall.If you best forex robot have enough money, in such an unstable situation Event You can use the help of bad credit business loans. I believe that the company forex trading platform is not only the name, people who suffer from bad credit business loans, bad credit, especially in the United States.As with any of asset financing these bad credit loans and financing these same day loans arrears records For a variety of reasons, breach of contract lawsuit municipalities, people who IVA, bankruptcy, same day loans arrears, you can no credit check loans apply jump.

by Unregistered Visitor on 09/26/14

jassica

These measurements may not mean much to you, but the insertable measurement just might. You’ll be pleased to know that while this SparXXrX® bullet is small it is mighty as well. sparxxrx

by Unregistered Visitor on 10/02/14

somewhere that

dozen't have a credit status in the absence of a mortgage loan to the people, there is a risk 24x7 fast loans that the offer is a lot of risk at the expense, they said they can get the maximum benefit, therefore, the 24x8 payday loans no credit check are higher interest rates for these payday loans no credit check this issue somewhat if you do a search on the Web can be resolved because you do not have to worry at all. well quick loans Web search is adequate financing Will help you in choosing a loan. The reality of life for many people in the financial perspective, is the middle class of the life payroll salary earners for max fast loans the majority, the ability to satisfy your basic monthly expenses, and even some minor matches based on your quick loans salary and can give unpredictable repair. generally, people can do successfully in this financial swift instant loans situation as a way to learn how to manage their resources, but which comes with an unexpected Bill, needed repairs or overwhelmed when faced with something. The A-month lending instant loans company is faced with the need 24x7 text loans for the money as soon as people on a budget can meet the requirements of being a sensitive person were developed. the loan is similar to a small amount of the cash advance, pay the txt loans generally. no longer is 1, A pounds, or a loan because of the industry's competitiveness;the nature 24x7 loans for people on benefits and ease of use, customer service has loans for people on benefits evolved greatly, assuming the loan

by Unregistered Visitor on 10/14/14

Add comment