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 ( ...
随机推荐
- ①SpringCloud前序知识-CAP原则
本文主要介绍SpringCloud里头一些常见的原理.定理等相关SpringCloud的技术知识 一.CAP原则 CAP原则又称CAP定理,指的是在一个分布式系统中,Consistency(一致性). ...
- Ununto16.04版本Docker的安装2018年最新版本
最近参照网上教程安装ubuntu的Docker怎么都不成功,我最后参照官方文档成功安装 https://docs.docker.com/engine/installation/linux/docker ...
- 关于Gateway
为什么要有gateway?就是因为如果没有,很多的功能需要在在每个微服务中都实现,这样成本很高.
- 在centos6.6中mysql5.5的编译、安装、配置
今天根据需求要在centos6.6上编译安装mysql5.5,因为以前编译安装过感觉很简单,但是今天还是出现了点小问题,所以把过安装过程总结了一下: 好像从mysql5.5开始编译安装mysql需要用 ...
- gen_fsm的学习笔记
网上搜索gen_fsm的例子,90%都是code_lock,依葫芦画瓢弄了下,记录一些学习心得 init(UnLockCode) -> process_flag(trap_exit,true), ...
- c#实现QQ群成员列表导出及邮件群发开篇
主题已迁移至:http://atiblogs.com/ ITO-神奇的程序员
- CAN总线标准帧
CAN总线是一种串行数据通信协议,其通信接口中集成了CAN协议的物理层和数据链路层功能,可完成对通信数据的成帧处理,包括位填充.数据块编码.循环冗余检验.优先级判别等项工作. CAN总线结构 CAN总 ...
- zufeoj 数值排序(简单题)
数值排序 时间限制: 1 Sec 内存限制: 128 MB提交: 186 解决: 45[提交][状态][讨论版] 题目描述 输入一串数字,把这串数字中的‘0’都看成空格,那么就得到一行用空格分割的 ...
- MVC原理图解
注解: 视图中通过Action方法向控制器请求数据 控制器通过view()方法向视图呈现数据
- HDFS案例
shell日志采集 需求说明 点击流日志每天都10T,在业务应用服务器上,需要准实时上传至数据仓库(Hadoop HDFS)上 需求分析 一般上传文件都是在凌晨24点操作,由于很多种类的业务数据都要在 ...