编译C lib for iPhone [英] Compile C lib for iPhone

查看:161
本文介绍了编译C lib for iPhone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译ZeroMQ C绑定,以便能够在iPhone上使用它,这里是我的配置选项:

I'm trying to compile ZeroMQ C binding in order to be able to use it on iPhone, here is my configure options:


./configure --host = arm-apple-darwin --enable-static = yes --enable-shared = no CC = / Developer / Platforms / iPhoneOS.platform / Developer / usr / bin / arm-apple -darwin10-gcc-4.2.1 CFLAGS = - pipe -std = c99 -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wunused-variable -fmessage-length = 0 -fvisibility = hidden -miphoneos-version- min = 3.1.2 -gdwarf-2 -mthumb -I / Library / iPhone / include -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk -mdynamic-no-picCPP = / Developer /Platforms/iPhoneOS.platform/Developer/usr/bin/cpp AR = / Developer / Platforms / iPhoneOS.platform / Developer / usr / bin / ar AS = / Developer / Platforms / iPhoneOS.platform / Developer / usr / bin / as LIBTOOL = / Developer / Platforms / iPhoneOS.platform / Developer / usr / bin / libtool STRIP = / Developer / Platforms / iPhoneOS.platform / Developer / usr / bin / strip RANLIB = / Developer / Platforms / iPhoneOS.platform / Developer / usr / bin / ranlib

它实际上配置和编译很好,但是当我将它添加到Xcode Frameworks部分时, : ld:warning:在/path/to/app/libzmq.a中,文件是为不支持的文件格式构建的,这不是被链接的架构(armv7)

It actually configures and compiles fine, but when I add it to Xcode Frameworks section, I get warning: ld: warning: in /path/to/app/libzmq.a, file was built for unsupported file format which is not the architecture being linked (armv7) and a lot of symbol not found errors.

如果我将当前活动结构从armv6更改为armv7,警告消息将更改为armv6。
我做错了什么?

If I change current active architecture from armv6 to armv7, warning message will change it to armv6. What am I doing wrong ?

感谢,
Dan

Thanks, Dan

推荐答案

听起来你正在为iPhone构建一个通用armv6 / armv7二进制文件(这是默认的,所以这是有道理的)。这意味着你需要构建一个通用库来链接。建立两个库,然后使用 lipo 来组合这两个库。

It sounds like you're building a universal armv6/armv7 binary for the iPhone (this is the default, so that makes sense). That means that you need to build a universal library to link against. Build both libraries, and then use lipo to combine the two.

,构建armv6并将其放置在 armv6 / libfoo.a ,并将armv7放在 armv7 / libfoo.a 。然后执行

For example, build the armv6 one and place it at armv6/libfoo.a, and the armv7 one at armv7/libfoo.a. Then run

lipo -arch armv6 armv6/libfoo.a -arch armv7 armv7/libfoo.a -output libfoo.a -create

创建通用库 libfoo.a

这篇关于编译C lib for iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆