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 ( ...
随机推荐
- eclipse “”base revision” vs. “latest from repository”
base revision(基本版本):代表的是最近一次从svn服务器上面获取的版本内容:本质还是本地版本,只不过这个版本是上次从服务器上面获取的. lastest from resource(资源库 ...
- etcd使用经历
etcd是一个开源的.分布式的键值对数据存储系统,提供共享配置.服务的注册和发现.etcd与zookeeper相比算是轻量级系统,两者的一致性协议也一样,etcd的raft比zookeeper的pax ...
- 分布式缓存系统 Memcached 状态机之SET、GET命令
首先对状态机中的各种状态做个简单总结,具体可见状态转换示意图: 1.listening:这个状态是主线程的默认状态,它只有这一个状态:负责监听socket,接收客户连接,将连接socket派发给工作线 ...
- easyui tree 加载展开全部节点
$(function () { $('#tbClientListCont').tree({ checkbox: false, url: '/ashx/Client/tbClientList.ashx? ...
- 1121 Damn Single
题意: 给出n对情侣,然后给出聚会上的m个人,问这m个人中有几个人事落单的. 思路: 首先,开一个数组couple[]存储情侣间的映射关系:然后,用exist[]标记聚会上出现过的人:最后遍历0~N, ...
- 事件调度器及C++中的使用
转自:http://blog.ch-wind.com/ue4-event-dispatcher-and-delegate/ 事件调度器非常的适合在各个蓝图之间实现通信功能. 当前UE4版本4.8.3. ...
- 双杀 0day 漏洞(CVE-2018-8174)复现
漏洞描述: CVE-2018-8174 是 Windows VBScript Engine 代码执行漏洞. 微软在4月20日早上确认此漏洞,并于5月8号发布了官方安全补丁,对该 0day 漏洞进行了修 ...
- springboot成神之——Scheduler定时任务
本文介绍spring的Scheduler定时任务 目录结构 config scheduler @Scheduled配置参数 本文介绍spring的Scheduler定时任务 目录结构 config / ...
- (转)CSS布局-负边距-margin
css中的负边距(negative margin)是布局中的一个常用技巧,只要运用得合理常常会有意想不到的效果.很多特殊的css布局方法都依赖于负边距,所以掌握它的用法对于前端的同学来说,那是必须的. ...
- 【原创】0. MYSQL++的环境准备
1. 获取 Google MYSQL++,第一个就是,然后跟着要求进行下载. 2. 编译和安装 其实在作者的各种README文档里面已经写得很清楚了,现在对一些可能会出现问题的地方进行一下回顾. Wi ...