加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

为iPhone编译C lib

发布时间:2020-12-15 01:43:31 所属栏目:百科 来源:网络整理
导读:我正在尝试编译ZeroMQ C绑定以便能够在iPhone上使用它,这是我的配置选项: ./configure –host = arm-apple-darwin –enable-static = yes –enable-shared = no CC = / Developer / Platforms / iPhoneOS.platform / Developer /usr/bin/arm-apple-darwin10
我正在尝试编译ZeroMQ C绑定以便能够在iPhone上使用它,这是我的配置选项:

./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-pic“CPP = / 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)和很多符号未找到错误.

如果我将当前活动架构从armv6更改为armv7,警告消息会将其更改为armv6.
我究竟做错了什么 ?

谢谢,

解决方法

听起来你正在为iPhone构建一个通用的armv6 / armv7二进制文件(这是默认的,所以这很有意义).这意味着您需要构建一个通用库来链接.构建两个库,然后使用lipo将两者结合起来.

例如,构建armv6 one并将其放在armv6 / libfoo.a中,将armv7放在armv7 / libfoo.a中.然后跑

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

创建通用库libfoo.a.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读