I’ve created an Xcode 4 project template to create universal (armv6, armv7 and simulator) static libraries for iOS, based on Adam Martin’s script:
iOS-Universal-Library-Template
The existing static library template provided with Xcode only builds one architecture, which is not particularly suitable for distribution. A number of people have created scripts to create universal libraries, which require some mucking around with Xcode target settings to use.
This template draws on this work to provide all that is required to produce universal libraries – just select the ‘Universal Static Library’ type in the New Project/New Target dialog, and you’re all set.
Avoiding duplicate symbol issues when using common utilities within a static library
In case the solution was useful to others, here’s how I worked around it: Use the preprocessor to rename the symbols automatically during the build phase.
This is done by adding a series of
-DOldSymbol=NewSymbol
flags to the ‘Other C Flags’ build setting – like-DTPCircularBuffer=ABCircularBuffer
, for instance.No more symbol conflicts.