Xcode 中两个具有重复符号的静态库
我有两个静态库,它们似乎有重复的符号(TBXML.o)并且无法编译。
ld: duplicate symbol _OBJC_METACLASS_$_TBXML in /Users/Hoya/Desktop/SocialSync/include/SMUFLib/deviceLib/libSFCommonLibs.a(TBXML.o) and /Users/Hoya/Desktop/SocialSync/Cauly/libCaulyDevice.a(TBXML.o) for architecture armv6
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1
这两个库的开发人员不提供源代码,因此我无法直接编辑代码来修复它。
我能做些什么来解决这个问题而不打扰图书馆开发人员吗?
I have two static libraries which seem to have duplicate symbols(TBXML.o) and won't compile.
ld: duplicate symbol _OBJC_METACLASS_$_TBXML in /Users/Hoya/Desktop/SocialSync/include/SMUFLib/deviceLib/libSFCommonLibs.a(TBXML.o) and /Users/Hoya/Desktop/SocialSync/Cauly/libCaulyDevice.a(TBXML.o) for architecture armv6
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1
The developer of both libraries don't provide the source code so there is nothing I can do to edit the code directly to fix it.
Is there anything I can do to work around this without nagging the library developers?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
第 1 部分——弄清楚这些符号是否代表同一对象。
注意:这是 OS X 特定的。
好吧,让我们看看如何查看它们的反汇编。
您可以使用
otool
来执行此操作:并
检查反汇编,看看它们是否相同,如果是,那么您很幸运:-)
如果 foo.a(bar.o ) 上述命令的格式不起作用(无论出于何种原因,尽管它应该起作用),您可以通过从两者中删除 (TBXML.o) 来尝试,但随后您必须做更多的工作。
如果它们相同,那么您可以轻松地使用 otool + lipo 重建两个 .a 文件之一,以便 TBXML.o 不在其中。
如果它们不同,则必须完成更多的技巧: )甚至可能不容易实现。
Part 1 -- Figuring out whether or not the symbols represent same object.
Note: This is OS X specific.
Okay let's look at how to can look at their disassembly.
You may be able to use the
otool
to do this:and
Examine the disassembly to see if they are the same, if so then you are in luck :-)
If the foo.a(bar.o) format of the above commands doesn't work (for whatever reason although it should) you can try it by removing the (TBXML.o) from both but then you'd have to do a bit more work.
If they ARE the same then you can easily use the otool + lipo to rebuild ONE of the two .a files so that TBXML.o is not in it
In case they aren't the same then a lot more trickery has to be done :) may not even be possible easily.