iOS 4.1 SDK - 多个静态库中的重复符号链接设备构建

时间:2010-09-23 19:19:34

标签: xcode ios4 linker ios xcodebuild

我的公司正在为iPhone构建一个带有SDK 4.1的应用程序。

为此,我们有3个级别的项目依赖项,我们的主要应用程序“CSM”链接到名为“csm-sdk”的SDK(在libsrc_csmsdk.a中)csm-sdk然后链接到我们的XMLRPC库(“libXMLRPC。一“)。

在为设备编译csm-sdk时,它包括所有ObjC类的定义,以及两次用于XMLRPC库的C函数。

然后,当CSM链接时,它会在同一个库文件中报告重复对象。

我们在所有级别使用-all_load和-ObjC进行链接。

我有另一个项目在SDK 3.2上做类似的事情,一切正常......而这个项目在4.1上作为模拟器构建一切正常,只有设备失败。有没有人遇到类似的东西?

以下更多详情。

谢谢!

Glenn R. Martin

构建错误:

ld: duplicate symbol _OBJC_METACLASS_$_XMLParser in /Users/builder/cc/workingdirs/iphoneclient/csm-sdk/build/Release-iphoneos/libsrc_csmsdk.a(XMLParser.o) and /Users/builder/cc/workingdirs/iphoneclient/csm-sdk/build/Release-iphoneos/libsrc_csmsdk.a(XMLParser.o)
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
ProcessProductPackaging "/Users/builder/Library/MobileDevice/Provisioning Profiles/6EB9AEE7-A844-4017-B076-06C3240F869B.mobileprovision" "build/Release-iphoneos/CSM.app/embedded.mobileprovision"
    cd /Users/builder/cc/workingdirs/iphoneclient
    setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
    <com.apple.tools.product-pkg-utility> "/Users/builder/Library/MobileDevice/Provisioning Profiles/6EB9AEE7-A844-4017-B076-06C3240F869B.mobileprovision" -o "/Users/builder/cc/workingdirs/iphoneclient/build/Release-iphoneos/CSM.app/embedded.mobileprovision"

ProcessProductPackaging dist.plist "build/CSM.build/Release-iphoneos/CSM.build/CSM.xcent"
    cd /Users/builder/cc/workingdirs/iphoneclient
    setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
    <com.apple.tools.product-pkg-utility> /Users/builder/cc/workingdirs/iphoneclient/dist.plist -entitlements -format xml -o "/Users/builder/cc/workingdirs/iphoneclient/build/CSM.build/Release-iphoneos/CSM.build/CSM.xcent"

** BUILD FAILED **


The following build commands failed:
CSM:
   Ld "/Users/builder/cc/workingdirs/iphoneclient/build/CSM.build/Release-iphoneos/CSM.build/Objects-normal/armv6/CSM" normal armv6
   Ld "/Users/builder/cc/workingdirs/iphoneclient/build/CSM.build/Release-iphoneos/CSM.build/Objects-normal/armv7/CSM" normal armv7
(2 failures)

Release BUILD failed

设备的otool转储:

Archive : csm-sdk/build/Release-iphoneos/libsrc_csmsdk.a (architecture armv7)
Table of contents from: csm-sdk/build/Release-iphoneos/libsrc_csmsdk.a(__.SYMDEF) (for architecture armv7)
size of ranlib structures: 1960 (number 245)
size of strings: 6256

object           symbol name
XMLParser.o   _OBJC_CLASS_$_XMLParser
XMLParser.o   _OBJC_METACLASS_$_XMLParser
XMLParser.o   .objc_class_name_XMLParser
XMLRPC.o      _OBJC_IVAR_$_XMLRPC._asynchronousData
XMLRPC.o      _OBJC_IVAR_$_XMLRPC._methodName
XMLRPC.o      _OBJC_IVAR_$_XMLRPC._asynchronousConnection
XMLRPC.o      _OBJC_IVAR_$_XMLRPC._asynchronous
XMLRPC.o      _OBJC_IVAR_$_XMLRPC._asyncRequestInProgress
XMLRPC.o      _OBJC_IVAR_$_XMLRPC._queueRequests
XMLRPC.o      _OBJC_IVAR_$_XMLRPC._requestTimeout
XMLRPC.o      _OBJC_IVAR_$_XMLRPC._serviceUrl
XMLRPC.o      _OBJC_IVAR_$_XMLRPC._cachingPolicy
XMLRPC.o      _OBJC_METACLASS_$_XMLRPC
XMLRPC.o      .objc_class_name_XMLRPC
XMLRPC.o      _OBJC_CLASS_$_XMLRPC

... Clipped for Brevity ...

CSMWebservice.o l_OBJC_LABEL_PROTOCOL_$_NSObject
CSMWebservice.o l_OBJC_LABEL_PROTOCOL_$_XMLRPCDelegate
XMLParser.o   _OBJC_METACLASS_$_XMLParser
XMLParser.o   .objc_class_name_XMLParser
XMLParser.o   _OBJC_CLASS_$_XMLParser
XMLRPC.o      _OBJC_IVAR_$_XMLRPC._methodName
XMLRPC.o      _OBJC_IVAR_$_XMLRPC._asynchronousConnection
XMLRPC.o      _OBJC_IVAR_$_XMLRPC._delegate
XMLRPC.o      _OBJC_IVAR_$_XMLRPC._serviceUrl
XMLRPC.o      _OBJC_IVAR_$_XMLRPC._queueRequests
XMLRPC.o      _OBJC_IVAR_$_XMLRPC._requestTimeout
XMLRPC.o      _OBJC_IVAR_$_XMLRPC._asynchronousError
XMLRPC.o      .objc_class_name_XMLRPC
XMLRPC.o      _OBJC_CLASS_$_XMLRPC

模拟器的otool转储:

Archive : csm-sdk/build/Release-iphonesimulator/libsrc_csmsdk.a
Table of contents from: csm-sdk/build/Release-iphonesimulator/libsrc_csmsdk.a(__.SYMDEF)
size of ranlib structures: 1520 (number 190)
size of strings: 5080

object           symbol name
CSMWebservice.o _OBJC_METACLASS_$_CSMWebservice
CSMWebservice.o _OBJC_CLASS_$_CSMWebservice
CSMWebservice.o l_OBJC_LABEL_PROTOCOL_$_NSObject
XMLParser.o   _OBJC_CLASS_$_XMLParser
XMLParser.o   _OBJC_METACLASS_$_XMLParser
XMLParser.o   .objc_class_name_XMLParser
... No duplication, clipped for brevity ...

2 个答案:

答案 0 :(得分:0)

您应该链接最终应用部署目标中的所有内容,而不是单个子目标。

答案 1 :(得分:0)

这是4.1中的已知错误,事实上当我在rdar上列出它时,它被列为重复。我被告知它最近已被修复,只希望修复程序在下一个版本中出现。