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 ( ...
随机推荐
- hive字段原理--有删除一列想到的
hive删除一张表的字段不会动数据文件,只是修改了一下metadata表里面的表定义:所以会出现一种情况:就是这张表如果之前数据是满的(个格列都有数据),那么被删除的那列后数据都往前窜了一个,最后一个 ...
- shell查看执行过程及时间变量
sh -xv test.sh #加参数xv查看shell执行过程. Shell 调用系统时间变量 获取今天时期:`date +%Y%m%d` 或 `date +%F` 或date +%Y-%m- ...
- 【Http认证方式】——Basic认证
访问请求:http://192.168.2.113:8080/geoserver/rest/workspaces时,浏览器弹出窗口需要输入用户名和密码 ,并且,如果不输入或者输入错误,浏览器返回 ...
- yii console
Here is a step by step to show how to run command in the server with yii framework. 1. Create the we ...
- mysql基础之四:int(M)中M的含义
昨天写sql文件时把以前一直不是很明白的地方弄明白了,就是在设置int型的时候,需要设置int(M),以前知道这个M最大是255,但是到底应该设置多少并没有在意. 查了下官方manual 有这样的语句 ...
- 环境搭建:Vue环境搭建和项目初始化(ubuntu)
1. 安装node.js(版本6.10.3) 首先确保系统安装来gcc,g++,如果没有则安装: $ sudo apt-get update $ sudo apt-get install gcc ...
- mysql枚举类型与集合类型
枚举类型与集合类型 字段的值只能在给定范围中选择,如单选框,多选框 enum 单选 只能在给定的范围内选一个值,如性别 sex 男male/女female set 多选 在给定的范围内可以选择一个或一 ...
- 【面试】D
昨天去了慕名已久的Dell面试(Dell自2015年退出了世界500强的评比),一面基本合格,二面基本没答上... 对公司的整体印象非常好(每个人桌上都有两台很大的显示器:9:00-15:30,如果能 ...
- PHP安装使用Zend Opcache扩展
简介 Zend OPCache 的前身是Zend Optimizer + (Zend O+),于 2013年3月中旬改名为 Opcache.其通过 opcode 缓存和优化提供更快的 PHP 执行过程 ...
- JAXB 专题二(BSP接口实战)
BSP下单接口 1.xml格式如下 <?xml version="1.0" encoding="utf-8"?> <Request servi ...