Build fat static library (device + simulator) using Xcode and SDK 4+
It appears that we can - theoretically - build a single static library that includes both simulator and iPhone and iPad. However, Apple has no documentation on this that I can find, and Xcode's default templates are NOT configured to do this. I'm looking for a simple, portable, re-usable technique that can be done inside Xcode. Some history:
References:
|
|||||||||||||||||||||||||||||||
|
protected by Brad Larson♦ Apr 13 '11 at 15:52
This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.
ALTERNATIVES: https://gist.github.com/3705459 - easy copy/paste of latest version (but install instructions may change - see below!) Karl's library (http://stackoverflow.com/a/5721978/153422 ) takes much more effort to setup, but much nicer long-term solution (it converts your library into a Framework). RECENT CHANGES:
SCRIPT (this is what you have to copy/paste) For usage / install instructions, see below
INSTALL INSTRUCTIONS
...BONUS OPTIONAL usage:
If you can't find the output file, here's a workaround:
How to include "non sourcecode" files in your project (PNG, PLIST, XML, etc)
Script to auto-copy the built bundle(s) into same folder as your FAT static library:
|
|||||||||||||||||||||||||||||||
|


I've made an XCode 4 project template that lets you make a universal framework as easily as making a regular library: |
|||||||||||||||||||||||||||||||
|
There is a command-line utility
Maybe looks inefficient(I'm not good at shell script), but easy to understand. I configured a new target running only this script. The script is designed for command-line but not tested in :) The core concept is I tried many configurations within Xcode UI, but nothing worked. Because this is a kind of batch processing, so command-line design is more suitable, so Apple removed batch build feature from Xcode gradually. So I don't expect they offer UI based batch build feature in future. |
|||||||||||||||||||||||||||||||
add comment (requires 50 reputation) |
I have spent many hours trying to build a fat static library that will work on armv7, armv7s, and the simulator. Finally found a solution here:http://www.nearinfinity.com/blogs/tyler_vernon/2012/07/17/creating-and-using-static-libraries-for-iphone-using-xcode-4.3.html The gist is to build the two libraries (one for the device and then one for the simulator) separately, rename them to distinguish from each other, and then lipo -create them into one library.
I tried it and it works! |
|||||||||||||||||||||||||
add comment (requires 50 reputation) |
I've made this into an Xcode 4 template, in the same vein as Karl's static framework template. I found that building static frameworks (instead of plain static libraries) was causing random crashes with LLVM, due to an apparent linker bug - so, I guess static libraries are still useful! |
|||||||
add comment (requires 50 reputation) |
Great job! I hacked together something similar, but had to run it separately. Having it just be part of the build process makes it so much simpler. One item of note. I noticed that it doesn't copy over any of the include files that you mark as public. I've adapted what I had in my script to yours and it works fairly well. Paste the following to the end of your script.
|
|||||||
|
Build fat static library (device + simulator) using Xcode and SDK 4+的更多相关文章
- 创建静态库Static Library(Framework库原理相似)
在项目开发的过程中,经常使用静态库文件.例如两个公司之间业务交流,不可能把源代码都发送给另一个公司,这时候将私密内容打包成静态库,别人只能调用接口,而不能知道其中实现的细节. 简介: 库是一些没有ma ...
- iOS 元件组件-创建静态库static library
概述 在项目开发的过程中,经常使用静态库文件.例如两个公司之间业务交流,不可能把源代码都发送给另一个公司,这时候将私密内容打包成静态库,别人只能调用接口,而不能知道其中实现的细节. 库是一些没有mai ...
- 使用Xcode 5创建Cocoa Touch Static Library(静态库)
转自:http://blog.csdn.net/jymn_chen/article/details/21036035 首先科普一下静态库的相关知识: 程序编译一般需经预处理.编译.汇编和链接几个步骤. ...
- Creating and Using Static Libraries for iPhone using Xcode 4.3
Recently, after developing a collection of applications for iPhone that were intended to be used as ...
- ios中静态库的创建和使用、制作通用静态库(Cocoa Touch Static Library)
创建静态库可能出于以下几个理由: 1.你想将工具类代码或者第三方插件快捷的分享给其他人而无需拷贝大量文件.2.你想让一些通用代码处于自己的掌控之下,以便于修复和升级.3.你想将库共享给其他人,但不想让 ...
- Objective-C categories in static library
ASK: Can you guide me how to properly link static library to iphone project. I use staic library pro ...
- How do I fix "selector not recognized" runtime exceptions when trying to use category methods from a static library?
https://developer.apple.com/library/content/qa/qa1490/_index.html A: If you're seeing a "select ...
- iOS制作Static Library(静态库),实现多工程的连编
在iOS开发中,我们会发现一些偏底层或基础代码是直接可以复用的,当我们换一个项目,改变的只需要是偏上层的业务逻辑代码,所以我们可以把这部分基础代码制作为一个静态库static library,并不断扩 ...
- Can't debug c++ project because unable to static library start program *.lib
Can't debug c++ project because unable to static library start program *.lib I'm using a library ( ...
随机推荐
- WS-* 协议
Web服务作为实现SOA中服务的最主要手段.跟Web Service相关的标准,它们大多以“WS-”作为名字的前缀,所以统称WS-*. Web服务最基本的协议包括UDDI,WSDL和SOAP,通过它们 ...
- mysql + unidac 使用事务例子
//备注:mysql必须是使用innoDB引擎才支持事务功能,否则以下事务相关代码将失效.//SQL SERVER和Oracle还没试,明天回公司试了再发代码.procedure TForm1.btn ...
- 【转】在Linux下使用Jmeter执行测试任务
想在Linux下运行jmeter必须先安装jdk,安装步骤如下: (1).下载一个linux可用的jdk包(比如:jdk-6u45-linux-i586.bin), (2).然后将jdk-6u45-l ...
- java中的getProperty()方法。获取系统中属性名为key的属性对应的值
总结:getProperty方法:获取系统中属性名为key的属性对应的值,系统中常见的属性名以及属性如下: 现在用getProperty()的方法,获取系统信息代码: package com.aaa; ...
- zufeoj 花生(The Peanuts)
花生(The Peanuts) 时间限制: 1 Sec 内存限制: 128 MB提交: 3 解决: 2[提交][状态][讨论版] 题目描述 鲁宾逊先生和他的宠物猴,多多,非常喜欢花生.有一天,他们 ...
- Java-Runoob:Java 运算符
ylbtech-Java-Runoob:Java 运算符 1.返回顶部 1. Java 运算符 计算机的最基本用途之一就是执行数学运算,作为一门计算机语言,Java也提供了一套丰富的运算符来操纵变量. ...
- krpano之语音介绍
语音介绍:在每进入一个场景时,播放一段该场景的语音介绍. 制作步骤: 1.定义全局事件.在关闭场景时执行stopsounds(),在打开新场景时执行automusic(). <events on ...
- angularJS学习(三)——搭建学习环境
1.安装Node.js 和Testacular 1.1. 安装Node.js及配置部分,在另一篇博文:node.js的安装里面讲到了,地址是:http://www.cnblogs.com/tianxu ...
- java StirngStringbufferStringbuild的区别
java StirngStringbufferStringbuild的区别 String 1,Stirng是对象不是基本数据类型 2,String是final类,不能被继承.是不可变对象,一旦创建, ...
- Hadoop之MapReduce(二)序列化,排序及分区
MapReduce的序列化 序列化(Serialization)是指把结构化对象转化为字节流. 反序列化(Deserialization)是序列化的逆过程.把字节流转为结构化对象. 当要在进程间传递对 ...