ld:在iOS 4.3上复制符号_objc_retainedObject,但在iOS 5.0上没有 [英] ld: duplicate symbol _objc_retainedObject on iOS 4.3 , but not on iOS 5.0

查看:233
本文介绍了ld:在iOS 4.3上复制符号_objc_retainedObject,但在iOS 5.0上没有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



一些背景 - 我使用Diney指南构建了一个自定义框架 http://db-in.com/blog/2011/07/universal-framework-iphone-ios-2-0/

它是为armv6 / armv7构建的,它是一个基于ARC的框架,编译时的解复目标为4.3。

Its built for both armv6 / armv7 , its an ARC-based framework, compiled with a depolyment target of 4.3.

当我把结果框架放在一个5.0项目中时,它工作得很好,但当我把它放在一个4.3项目(ARC或非弧形,无所谓)时,我得到以下我无法理解的......

When i put the resulting framework in a 5.0 project it works great, but when i put it in a 4.3 project (ARC or non-arc, doesnt matter), i get the following which i can't really understand ...

我也尝试手动添加libarclite.a但它没有改变任何东西。

I've also tried adding libarclite.a manually but it didn't change anything.


ld:/Users/freak4pc/Project/MyFramework.framework/MyFramework和/Developer/Platforms/iPhoneOS.platform/中的重复符号_objc_retainedObject开发人员/ usr / lib / arc / libarclite_iphoneos.a(arclite.o),用于架构armv7
命令/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang失败,退出代码为1

ld: duplicate symbol _objc_retainedObject in /Users/freak4pc/Project/MyFramework.framework/MyFramework and /Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/arc/libarclite_iphoneos.a(arclite.o) for architecture armv7 Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1

非常感谢任何帮助。
谢谢
Shai

Would appreciate any help on this.
Thanks
Shai

推荐答案

我正在努力解决同样的问题。解决方法是将框架的部署目标设置为iOS5(检查是否不会产生其他问题)。

I'm struggling with the same problem. The workaround is so set the deployment target of your framework to iOS5 (check if that doesn't make other problems though).

然后你必须如果定位iOS4,则在主项目中使用ARC,否则libarclite将丢失。我的解决方案是提供两个框架,具体取决于它们是否使用ARC。

Then you must use ARC in the master project if targeting iOS4, else libarclite will be missing. My solution will be to supply two frameworks, depending if they use ARC or not.

以下是Apple的开发论坛的两个链接,其中包含更多信息:
https://devforums.apple.com/message/539344#539344

Here's two links to Apple's dev forum with a little bit more info: https://devforums.apple.com/message/539344#539344

https://devforums.apple.com/消息/ 588316#588316

更新:
还有更好的方法。只需使用iOS5最小目标构建静态库,并手动添加/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/arc/libarclite_iphoneos.a(和/Developer/usr/lib/arc/libarclite_iphonesimulator.a)项目使用ARC并需要iOS4支持。

Update: There is a better way. Just build your static library with iOS5 minimum target, and manually add /Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/arc/libarclite_iphoneos.a (and /Developer/usr/lib/arc/libarclite_iphonesimulator.a) if your project is not using ARC and needs iOS4-support.

更新2:实际上,只需使用链接器标志-fobjc-arc;这将链接libarclite与库,如果它不在那里。最佳解决方案。

Update 2: Actually, just use the linker flag -fobjc-arc ; this will link libarclite with the library if it's not already in there. Best solution.

这篇关于ld:在iOS 4.3上复制符号_objc_retainedObject,但在iOS 5.0上没有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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