两个在Xcode中具有重复符号的静态库 [英] two static libraries with duplicate symbols in Xcode

查看:1125
本文介绍了两个在Xcode中具有重复符号的静态库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个静态库,似乎有重复的符号(TBXML.o),不能编译。

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.

推荐答案

第1部分 - 找出是否需要不是符号表示相同的对象。



注意:这是OS X特定的。



可以看看他们的拆卸。

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.

您可以使用 otool 执行此操作:

You may be able to use the otool to do this:

otool -v -t '/Users/Hoya/Desktop/SocialSync/Cauly/libCaulyDevice.a(TBXML.o)' 

otool -v -t '/Users/Hoya/Desktop/SocialSync/include/SMUFLib/deviceLib/libSFCommonLibs.a(TBXML.o)'

检查反汇编,看看它们是否相同,如果是这样,那么你是运气:-)

Examine the disassembly to see if they are the same, if so then you are in luck :-)

如果foo.a(bar.o)格式的上述命令不工作(无论出于什么原因,尽管它应该),你可以尝试通过从两个删除(TBXML.o),但然后你必须做一些更多的工作。

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.

如果他们是相同的,那么你可以很容易地使用otool + lipo重建两个.a文件之一,使TBXML.o不在其中

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.

这篇关于两个在Xcode中具有重复符号的静态库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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