xcode duplicate symbols lipo
来源:互联网 发布:three.js skybox 编辑:程序博客网 时间:2024/06/02 02:13
遇到引用库重复定义的问题,需要解决。项目需要,同时引用ZBar和QQ授权登录SDK,由于二者均使用了Base64处理数据,XCode编译时报错:duplicate symbol _base64_encode in:...\libzbar.a(symbol.o)...\TencentOpenAPI(base64.o)意思就是在这两个库中都定义了_base64_encode,编译器认为你重复定义了。至于为什么编译器认为重复定义,个人认为编译器编译全局变量时会根据名字进行编译,会把相同名称的全局变量编译为相同变量,也就是多个编译成一个,而编译器认为这样可能会引起错误,就提醒用户这里有错。解决方案: 参考了:http://blog.sina.com.cn/s/blog_4beb28f301012bl6.html删掉了 set building->other linker flag-> -all_loadios的Framework是共享动态库,不会被打包到app中,非系统Framework静态库都会被打包到app中,所以会产生"Duplicate Symbol"的错误。在Build Settings->Other link flags中删除所有的-all_load与-force_load, XCode会很smart的去掉"Duplicate Symbol"。以下是从外国友人那获取的终极解决策略,方案是修改类库:I'm going to assume that these are two third party libraries that have only provided you with the .a files and not the source code. You can use libtool, lipo and ar on the terminal to extract and recombine the files.假设有两个三方类库仅提供给你了.a文件,没有源码,你可以通过libtool, lipo和ar在terminal中解压合并他们。To see what architectures are in the file:查看文件都支持了什么架构$ lipo -info libTapjoy.aArchitectures in the fat file: libTapjoy.a are: armv6 i386Then to extract just armv6, for example:然后只解压armv6,例如$ lipo -extract_family armv6 -output libTapjoy-armv6.a libTapjoy.a$ mkdir armv6$ cd armv6$ ar -x ../libTapjoy-armv6.aYou can then extract the same architecture from the other library into the same directory and then recombine them like so:你可以从另一个类库中解压同样架构的部分,然后将两者合并在一起$ libtool -static -o ../lib-armv6.a *.oAnd then finally, after you've done this with each architecture, you can combine them again with lipo:如上所示,你可以将所有架构都按照这个流程走一遍,然后合并$ cd ..$ lipo -create -output lib.a lib-armv6.a lib-i386.aThis should get rid of any duplicate symbols, but will also combine the two libraries into one. If you want to keep them separate, or just delete the duplicate from one library, you can modify the process accordingly.这个过程不仅解决掉了duplicate symbols的问题,也将两个类库合并为一个。如果你想分别保存两个类库,你可以将duplicate的部分从任意一个类库中删除,你可以相应的修改这个过程。
阅读全文
0 0
- xcode duplicate symbols lipo
- Xcode Multiple Static Libraries and Duplicate Symbols
- Xcode中 xx duplicate symbols for architecture i386错误提示
- duplicate symbols for architecture arm64 after xCode 8.0 update
- xcode编译报错duplicate symbols for architecture arm64
- lipo (dumplicate symbols for architecture XXXX)
- Xcode iOS开发BUG记录:Undefined symbols for architecture i386 / duplicate symbol _OBJC_CLASS_
- duplicate symbols for architecture armv6
- duplicate symbols for architecture i386
- duplicate symbols for architecture arm64
- duplicate symbols for architecture armv7
- duplicate symbols for architecture x86_64
- duplicate symbols for architecture x86_64
- duplicate symbols for architecture x86_64
- duplicate symbols for architecture i386
- duplicate symbols for architecture i386
- duplicate symbols for architecture x86_64
- -ObjC引起的duplicate symbols
- combo_box SetCurSel(i)设置显示的内容
- 多重背包(二进制优化)
- 路由器工作在哪一层
- Intellij IDEA配置PHP开发环境
- git学习------>在CenterOS系统上安装GitLab并自定义域名访问GitLab管理页面
- xcode duplicate symbols lipo
- Eclipse快捷键
- 响应式布局
- Eclipse 快捷键 大全
- 最简单的基于librtmp的示例:发布H.264(H.264通过RTMP发布)——雷神经典
- 使用objdump objcopy查看与修改符号表
- apache-Mina学习笔记
- 3G模块SIM5360E实现拨号上网功能
- PHP中Header()的用法