Start a new topic

Undefined symbols for architecture x86_64 "_sqlite3*"

 Hi,


I am brand new to Kinvey and have just started with the iOS Swift development using Xcode 7.2.1. The Getting Started guide is very good and I followed the manual installation by downloading the latest KinveyKit framework v.1.40.7.


The framework was added successfully, bridging file is properly read but during the build, I receive 36 errors with 'Undefined symbols for architecture x86_64' and a bunch of "_sqlite3" symbol errors being referenced from KCS functions.


The complete list is attached below. What are these errors and what is the solution?


Thanks in advance.


Undefined symbols for architecture x86_64:
  "_sqlite3_bind_blob", referenced from:
      -[KCS_FMDatabase bindObject:toColumn:inStatement:] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_bind_double", referenced from:
      -[KCS_FMDatabase bindObject:toColumn:inStatement:] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_bind_int", referenced from:
      -[KCS_FMDatabase bindObject:toColumn:inStatement:] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_bind_int64", referenced from:
      -[KCS_FMDatabase bindObject:toColumn:inStatement:] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_bind_null", referenced from:
      -[KCS_FMDatabase bindObject:toColumn:inStatement:] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_bind_parameter_count", referenced from:
      -[KCS_FMDatabase executeQuery:withArgumentsInArray:orDictionary:orVAList:] in KinveyKit(KCS_FMDatabase.o)
      -[KCS_FMDatabase executeUpdate:error:withArgumentsInArray:orDictionary:orVAList:] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_bind_parameter_index", referenced from:
      -[KCS_FMDatabase executeQuery:withArgumentsInArray:orDictionary:orVAList:] in KinveyKit(KCS_FMDatabase.o)
      -[KCS_FMDatabase executeUpdate:error:withArgumentsInArray:orDictionary:orVAList:] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_bind_text", referenced from:
      -[KCS_FMDatabase bindObject:toColumn:inStatement:] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_busy_timeout", referenced from:
      -[KCS_FMDatabase open] in KinveyKit(KCS_FMDatabase.o)
      -[KCS_FMDatabase openWithFlags:] in KinveyKit(KCS_FMDatabase.o)
      -[KCS_FMDatabase setRetryTimeout:] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_changes", referenced from:
      -[KCS_FMDatabase changes] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_close", referenced from:
      -[KCS_FMDatabase close] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_column_blob", referenced from:
      -[KCS_FMResultSet dataForColumnIndex:] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMResultSet dataNoCopyForColumnIndex:] in KinveyKit(KCS_FMResultSet.o)
  "_sqlite3_column_bytes", referenced from:
      -[KCS_FMResultSet dataForColumnIndex:] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMResultSet dataNoCopyForColumnIndex:] in KinveyKit(KCS_FMResultSet.o)
  "_sqlite3_column_count", referenced from:
      -[KCS_FMResultSet columnCount] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMResultSet columnNameToIndexMap] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMResultSet kvcMagic:] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMResultSet resultDictionary] in KinveyKit(KCS_FMResultSet.o)
  "_sqlite3_column_double", referenced from:
      -[KCS_FMResultSet doubleForColumnIndex:] in KinveyKit(KCS_FMResultSet.o)
  "_sqlite3_column_int", referenced from:
      -[KCS_FMResultSet intForColumnIndex:] in KinveyKit(KCS_FMResultSet.o)
  "_sqlite3_column_int64", referenced from:
      -[KCS_FMResultSet longForColumnIndex:] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMResultSet longLongIntForColumnIndex:] in KinveyKit(KCS_FMResultSet.o)
  "_sqlite3_column_name", referenced from:
      -[KCS_FMResultSet columnNameToIndexMap] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMResultSet kvcMagic:] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMResultSet resultDictionary] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMResultSet columnNameForIndex:] in KinveyKit(KCS_FMResultSet.o)
  "_sqlite3_column_text", referenced from:
      -[KCS_FMResultSet kvcMagic:] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMResultSet stringForColumnIndex:] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMResultSet UTF8StringForColumnIndex:] in KinveyKit(KCS_FMResultSet.o)
  "_sqlite3_column_type", referenced from:
      -[KCS_FMResultSet stringForColumnIndex:] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMResultSet dateForColumnIndex:] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMResultSet dataForColumnIndex:] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMResultSet dataNoCopyForColumnIndex:] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMResultSet columnIndexIsNull:] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMResultSet UTF8StringForColumnIndex:] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMResultSet objectForColumnIndex:] in KinveyKit(KCS_FMResultSet.o)
      ...
  "_sqlite3_create_function", referenced from:
      -[KCS_FMDatabase makeFunctionNamed:maximumArguments:withBlock:] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_data_count", referenced from:
      -[KCS_FMResultSet resultDict] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMResultSet resultDictionary] in KinveyKit(KCS_FMResultSet.o)
  "_sqlite3_errcode", referenced from:
      -[KCS_FMResultSet hasAnotherRow] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMDatabase lastErrorCode] in KinveyKit(KCS_FMDatabase.o)
      -[KCS_FMDatabase errorWithMessage:] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_errmsg", referenced from:
      -[KCS_FMResultSet next] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMDatabase lastErrorMessage] in KinveyKit(KCS_FMDatabase.o)
      -[KCS_FMDatabase executeUpdate:error:withArgumentsInArray:orDictionary:orVAList:] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_finalize", referenced from:
      -[KCS_FMDatabase close] in KinveyKit(KCS_FMDatabase.o)
      -[KCS_FMDatabase executeQuery:withArgumentsInArray:orDictionary:orVAList:] in KinveyKit(KCS_FMDatabase.o)
      -[KCS_FMDatabase executeUpdate:error:withArgumentsInArray:orDictionary:orVAList:] in KinveyKit(KCS_FMDatabase.o)
      -[KCS_FMStatement close] in KinveyKit(KCS_FMDatabase.o)
      -[KCS_FMDatabase(KCS_FMDatabaseAdditions) validateSQL:error:] in KinveyKit(KCS_FMDatabaseAdditions.o)
  "_sqlite3_last_insert_rowid", referenced from:
      -[KCS_FMDatabase lastInsertRowId] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_libversion", referenced from:
      +[KCS_FMDatabase sqliteLibVersion] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_next_stmt", referenced from:
      -[KCS_FMDatabase close] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_open", referenced from:
      -[KCS_FMDatabase open] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_open_v2", referenced from:
      -[KCS_FMDatabase openWithFlags:] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_prepare_v2", referenced from:
      -[KCS_FMDatabase executeQuery:withArgumentsInArray:orDictionary:orVAList:] in KinveyKit(KCS_FMDatabase.o)
      -[KCS_FMDatabase executeUpdate:error:withArgumentsInArray:orDictionary:orVAList:] in KinveyKit(KCS_FMDatabase.o)
      -[KCS_FMDatabase(KCS_FMDatabaseAdditions) validateSQL:error:] in KinveyKit(KCS_FMDatabaseAdditions.o)
  "_sqlite3_reset", referenced from:
      -[KCS_FMDatabase executeUpdate:error:withArgumentsInArray:orDictionary:orVAList:] in KinveyKit(KCS_FMDatabase.o)
      -[KCS_FMStatement reset] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_step", referenced from:
      -[KCS_FMResultSet next] in KinveyKit(KCS_FMResultSet.o)
      -[KCS_FMDatabase executeUpdate:error:withArgumentsInArray:orDictionary:orVAList:] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_threadsafe", referenced from:
      +[KCS_FMDatabase isSQLiteThreadSafe] in KinveyKit(KCS_FMDatabase.o)
      -[KCS_FMDatabase initWithPath:] in KinveyKit(KCS_FMDatabase.o)
  "_sqlite3_user_data", referenced from:
      _KCS_FMDBBlockSQLiteCallBackFunction in KinveyKit(KCS_FMDatabase.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Sam,


Can you confirm you have added "libsqlite3.0.tbd" under "ProjectSettings"->"General"->"Linked Frameworks and Libraries" ?


Thanks,

Pranav

Kinvey Support

Hi,

Thanks. Yes. After I have added it to the "Linked Frameworks and Libraries', those errors go away. But now comes new errors as copied below. Are these documented anywhere?

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_WKWebView", referenced from:
      objc-class-ref in KinveyKit(KCSMICLoginViewController.o)
  "_SCNetworkReachabilityCreateWithAddress", referenced from:
      -[KCS_KSReachability initWithAddress:] in KinveyKit(KCS_KSReachability.o)
  "_SCNetworkReachabilityCreateWithName", referenced from:
      -[KCS_KSReachability initWithHost:] in KinveyKit(KCS_KSReachability.o)
  "_SCNetworkReachabilityGetFlags", referenced from:
      -[KCS_KSReachability initWithReachabilityRef:hostname:] in KinveyKit(KCS_KSReachability.o)
  "_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
      -[KCS_KSReachability initWithReachabilityRef:hostname:] in KinveyKit(KCS_KSReachability.o)
  "_SCNetworkReachabilitySetCallback", referenced from:
      -[KCS_KSReachability initWithReachabilityRef:hostname:] in KinveyKit(KCS_KSReachability.o)
  "_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
      -[KCS_KSReachability dealloc] in KinveyKit(KCS_KSReachability.o)
  "_UTTypeCopyPreferredTagWithClass", referenced from:
      _kcsMimeType in KinveyKit(KCSFileStore.o)
  "_UTTypeCreatePreferredIdentifierForTag", referenced from:
      _kcsMimeType in KinveyKit(KCSFileStore.o)
  "_kUTTagClassFilenameExtension", referenced from:
      _kcsMimeType in KinveyKit(KCSFileStore.o)
  "_kUTTagClassMIMEType", referenced from:
      _kcsMimeType in KinveyKit(KCSFileStore.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

 

By the way, this error only happens when the KinveyKit framework is added manually to the project. Cocoapods installation works fine.


 

Sam,


Can you please confirm that all the steps mentioned in the link below are followed properly?
http://devcenter.kinvey.com/ios/guides/getting-started#Setupmanually


Thanks,

Pranav

Kinvey Support

Hi Pranav,

Yes, I followed all of the manual set up process (except for the documentation installation) and it was still giving errors.

However, I found a solution on Stackoverflow that if we are getting all these linker errors, try adding the frameworks under "Target -> Info -> Compile Sources". And voila, it now works.

Again, Cocoapods installation works fine. This problem only occurs when the frameworks are added manually. I have since deleted the manual setup Xcode project and just move on with the Cocoapods version.

 

Sam,

I’m glad it is working for you now.

Thanks,
Pranav
Kinvey Support

 

HI Pranav,

While I found a solution somewhere else, my feedback is that Kinvey's documentation is highly inadequate. I can only speak for the iOS guide, but in itself, the guide contains too many statements and examples that do not work. I have posted many forum topics on this issue, where the documentation is incorrect or incomplete. I suggest that in addition to helping out users in this forum and answer questions, can you please bring it up to the support team to re-test and overhaul the documentation? It is frustrating to have to figure things out and debug Kinvey's problems instead of working on our code.

Thanks.

 

Login or Signup to post a comment