I've got an app successfully using the AWS SDK framework, and now I'm trying to import a static library as a homemade framework, sharing code with several of my other projects.
The problem is: in order to import my static library, I need to add the -ObjC
linker flag in order to import the library, but whenever I add that linker flag, AWS freaks out and gives me 40+ red compile errors.
I'm entirely new to linker flags and library importing, so I honestly don't really know where to start. I've done some research, but the best lead I can find is the suggestion that I could use -force_load
instead of -ObjC
, but that seems to require manually adding every ".m" file in the Build Phases section, and my library includes hundreds of such files.
Is there a simpler solution to this problem than adding every one of those files so I can use -force_load
? How can I get the AWK SDK and the needs of importing my library to play nicely together?
EDIT: From a suggestion in the comments, here is the error I'm getting when I add the -ObjC
linker flag. Without that flag (and without adding the static library), the app compiles successfully with the AWSiOSSDKv2
framework. But adding that linker flag (which, as I understand it, is needed for the static library, but even before adding that library) immediately results in this:
[code removed to fit within character limit]
EDIT 2: Based on Yosuke Matsuda's answer, I added libsqlite3.dylib
, which I was missing. Now the previous errors have disappeared, but I have dozens (hundreds?) of "duplicate symbol" lines, ending in a single red "Linker command failed with exit code 1" error. (I would include them all but, hilariously, they put my post at 73,111 characters, well over the 30,000 character limit.)
Funny thing is, they seem to be from conflicts caused by requirements of the frameworks themselves (for example, AWSCore
in the AWS Framework requires the Bolts
framework, but they seem to conflict with a bunch of duplicate symbols?).
And, as before, simply removing -ObjC
from the Linker Flags allows the app to compile normally and successfully.
duplicate symbol _OBJC_METACLASS_$_PodsDummy_Pods_Reachability in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(Pods-Reachability-dummy.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/Reachability.framework/Reachability(Pods-Reachability-dummy.o)
duplicate symbol _OBJC_CLASS_$_PodsDummy_Pods_Reachability in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(Pods-Reachability-dummy.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/Reachability.framework/Reachability(Pods-Reachability-dummy.o)
duplicate symbol _OBJC_IVAR_$_Reachability.reachabilityRef in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(Reachability.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/Reachability.framework/Reachability(Reachability.o)
duplicate symbol _OBJC_IVAR_$_Reachability.reachableOnWWAN in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(Reachability.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/Reachability.framework/Reachability(Reachability.o)
duplicate symbol _kReachabilityChangedNotification in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(Reachability.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/Reachability.framework/Reachability(Reachability.o)
duplicate symbol _OBJC_IVAR_$_Reachability.reachabilitySerialQueue in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(Reachability.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/Reachability.framework/Reachability(Reachability.o)
duplicate symbol _OBJC_IVAR_$_Reachability.reachableBlock in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(Reachability.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/Reachability.framework/Reachability(Reachability.o)
duplicate symbol _OBJC_IVAR_$_Reachability.unreachableBlock in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(Reachability.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/Reachability.framework/Reachability(Reachability.o)
duplicate symbol _OBJC_IVAR_$_Reachability.reachabilityObject in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(Reachability.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/Reachability.framework/Reachability(Reachability.o)
duplicate symbol _OBJC_CLASS_$_Reachability in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(Reachability.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/Reachability.framework/Reachability(Reachability.o)
duplicate symbol _OBJC_METACLASS_$_Reachability in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(Reachability.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/Reachability.framework/Reachability(Reachability.o)
duplicate symbol _OBJC_METACLASS_$_PodsDummy_Pods_XMLDictionary in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(Pods-XMLDictionary-dummy.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/XMLDictionary.framework/XMLDictionary(Pods-XMLDictionary-dummy.o)
duplicate symbol _OBJC_CLASS_$_PodsDummy_Pods_XMLDictionary in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(Pods-XMLDictionary-dummy.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/XMLDictionary.framework/XMLDictionary(Pods-XMLDictionary-dummy.o)
duplicate symbol _OBJC_IVAR_$_XMLDictionaryParser._collapseTextNodes in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(XMLDictionary.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/XMLDictionary.framework/XMLDictionary(XMLDictionary.o)
duplicate symbol _OBJC_IVAR_$_XMLDictionaryParser._stripEmptyNodes in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(XMLDictionary.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/XMLDictionary.framework/XMLDictionary(XMLDictionary.o)
duplicate symbol _OBJC_IVAR_$_XMLDictionaryParser._trimWhiteSpace in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(XMLDictionary.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/XMLDictionary.framework/XMLDictionary(XMLDictionary.o)
duplicate symbol _OBJC_IVAR_$_XMLDictionaryParser._alwaysUseArrays in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(XMLDictionary.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/XMLDictionary.framework/XMLDictionary(XMLDictionary.o)
duplicate symbol _OBJC_IVAR_$_XMLDictionaryParser._preserveComments in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(XMLDictionary.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/XMLDictionary.framework/XMLDictionary(XMLDictionary.o)
duplicate symbol _OBJC_IVAR_$_XMLDictionaryParser._wrapRootNode in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(XMLDictionary.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/XMLDictionary.framework/XMLDictionary(XMLDictionary.o)
duplicate symbol _OBJC_IVAR_$_XMLDictionaryParser._attributesMode in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(XMLDictionary.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/XMLDictionary.framework/XMLDictionary(XMLDictionary.o)
duplicate symbol _OBJC_IVAR_$_XMLDictionaryParser._nodeNameMode in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(XMLDictionary.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/XMLDictionary.framework/XMLDictionary(XMLDictionary.o)
duplicate symbol _OBJC_IVAR_$_XMLDictionaryParser._root in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(XMLDictionary.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/XMLDictionary.framework/XMLDictionary(XMLDictionary.o)
duplicate symbol _OBJC_IVAR_$_XMLDictionaryParser._stack in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(XMLDictionary.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/XMLDictionary.framework/XMLDictionary(XMLDictionary.o)
duplicate symbol _OBJC_IVAR_$_XMLDictionaryParser._text in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(XMLDictionary.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/XMLDictionary.framework/XMLDictionary(XMLDictionary.o)
duplicate symbol _OBJC_CLASS_$_XMLDictionaryParser in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(XMLDictionary.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/XMLDictionary.framework/XMLDictionary(XMLDictionary.o)
duplicate symbol _OBJC_METACLASS_$_XMLDictionaryParser in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(XMLDictionary.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/XMLDictionary.framework/XMLDictionary(XMLDictionary.o)
duplicate symbol _OBJC_IVAR_$_FMDatabase._databasePath in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMDatabase._openResultSets in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMDatabase._db in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMDatabase._logsErrors in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMDatabase._crashOnErrors in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMDatabase._maxBusyRetryTimeInterval in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMDatabase._startBusyRetryTime in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMDatabase._cachedStatements in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMDatabase._dateFormat in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMDatabase._isExecutingStatement in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMDatabase._traceExecution in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMDatabase._shouldCacheStatements in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _FMDBExecuteBulkSQLCallback in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMDatabase._inTransaction in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _FMDBBlockSQLiteCallBackFunction in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMDatabase._openFunctions in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMDatabase._checkedOut in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMStatement._statement in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMStatement._inUse in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMStatement._useCount in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMStatement._query in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_CLASS_$_FMDatabase in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_METACLASS_$_FMDatabase in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_CLASS_$_FMStatement in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_METACLASS_$_FMStatement in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabase.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabase.o)
duplicate symbol _OBJC_IVAR_$_FMDatabasePool._path in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabasePool.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabasePool.o)
duplicate symbol _OBJC_IVAR_$_FMDatabasePool._lockQueue in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabasePool.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabasePool.o)
duplicate symbol _OBJC_IVAR_$_FMDatabasePool._databaseInPool in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabasePool.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabasePool.o)
duplicate symbol _OBJC_IVAR_$_FMDatabasePool._databaseOutPool in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabasePool.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabasePool.o)
duplicate symbol _OBJC_IVAR_$_FMDatabasePool._openFlags in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabasePool.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabasePool.o)
duplicate symbol _OBJC_IVAR_$_FMDatabasePool._delegate in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabasePool.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabasePool.o)
duplicate symbol _OBJC_IVAR_$_FMDatabasePool._maximumNumberOfDatabasesToCreate in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabasePool.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabasePool.o)
duplicate symbol _OBJC_CLASS_$_FMDatabasePool in:
/Users/kornferry/Documents/Repositories/kf4ddemo/AWSiOSSDKv2.framework/AWSiOSSDKv2(FMDatabasePool.o)
/Users/kornferry/Documents/Repositories/kf4ddemo/FMDB.framework/FMDB(FMDatabasePool.o)
[And on and on and on, ending with...]
ld: 260 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The AWS Mobile SDK for iOS depends on libsqlite3.dylib
, libz.dylib
, and SystemConfiguration.framework
, but you are not providing them. That is the cause for the error message. This section of AWS Mobile SDK for iOS Developer Guide lists the necessary dependencies.