My company is building an app with SDK 4.1 for the iPhone.
To do this we have 3 levels of project dependencies, our main App "CSM" is linking to our SDK called "csm-sdk" (in libsrc_csmsdk.a) csm-sdk then links to our XMLRPC library ("libXMLRPC.a").
When compiling csm-sdk for the device, it include definitions for all of the ObjC classes, and C Functions for oue XMLRPC Library twice.
Then when CSM links, it reports Duplicate objects in the same library file.
We link at all levels with -all_load and -ObjC.
I have another project doing something similar on SDK 3.2, and everything works fine... And this project on 4.1 as a Simulator build everything works fine, only Device fails. Has anyone run in to something similar?
More details below.
Thanks!
Glenn R. Martin
Build Error:
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 dump of Device:
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 dump of Simulator:
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 ...