Apple Mach-O 链接器错误 sqlite3

Posted

技术标签:

【中文标题】Apple Mach-O 链接器错误 sqlite3【英文标题】:Apple Mach-O Linker Error sqlite3 【发布时间】:2015-01-10 17:11:00 【问题描述】:

我在构建我的应用程序时遇到了这个错误。谁能帮我解决这个问题?

我正在使用 swift 和 parse.com。非常感谢您的帮助!

由于我无法发布图片,所以我在下面发布了整个错误消息。

Undefined symbols for architecture i386:
  "_sqlite3_bind_blob", referenced from:
      -[PFSQLiteDatabase _bindObject:toColumn:inStatement:] in Parse(PFSQLiteDatabase.o)
  "_sqlite3_bind_double", referenced from:
      -[PFSQLiteDatabase _bindObject:toColumn:inStatement:] in Parse(PFSQLiteDatabase.o)
  "_sqlite3_bind_int64", referenced from:
      -[PFSQLiteDatabase _bindObject:toColumn:inStatement:] in Parse(PFSQLiteDatabase.o)
  "_sqlite3_bind_null", referenced from:
      -[PFSQLiteDatabase _bindObject:toColumn:inStatement:] in Parse(PFSQLiteDatabase.o)
  "_sqlite3_bind_parameter_count", referenced from:
      ___59-[PFSQLiteDatabase executeQueryAsync:withArgumentsInArray:]_block_invoke in Parse(PFSQLiteDatabase.o)
      ___57-[PFSQLiteDatabase executeSQLAsync:withArgumentsInArray:]_block_invoke in Parse(PFSQLiteDatabase.o)
  "_sqlite3_bind_text", referenced from:
      -[PFSQLiteDatabase _bindObject:toColumn:inStatement:] in Parse(PFSQLiteDatabase.o)
  "_sqlite3_close", referenced from:
      ___30-[PFSQLiteDatabase closeAsync]_block_invoke in Parse(PFSQLiteDatabase.o)
  "_sqlite3_column_blob", referenced from:
      -[PFSQLiteDatabaseResult dataForColumnIndex:] in Parse(PFSQLiteDatabaseResult.o)
  "_sqlite3_column_bytes", referenced from:
      -[PFSQLiteDatabaseResult dataForColumnIndex:] in Parse(PFSQLiteDatabaseResult.o)
  "_sqlite3_column_count", referenced from:
      -[PFSQLiteDatabaseResult columnNameToIndexMap] in Parse(PFSQLiteDatabaseResult.o)
  "_sqlite3_column_double", referenced from:
      -[PFSQLiteDatabaseResult doubleForColumnIndex:] in Parse(PFSQLiteDatabaseResult.o)
  "_sqlite3_column_int", referenced from:
      -[PFSQLiteDatabaseResult intForColumnIndex:] in Parse(PFSQLiteDatabaseResult.o)
  "_sqlite3_column_int64", referenced from:
      -[PFSQLiteDatabaseResult longForColumnIndex:] in Parse(PFSQLiteDatabaseResult.o)
  "_sqlite3_column_name", referenced from:
      -[PFSQLiteDatabaseResult columnNameToIndexMap] in Parse(PFSQLiteDatabaseResult.o)
  "_sqlite3_column_text", referenced from:
      -[PFSQLiteDatabaseResult stringForColumnIndex:] in Parse(PFSQLiteDatabaseResult.o)
  "_sqlite3_column_type", referenced from:
      -[PFSQLiteDatabaseResult objectForColumnIndex:] in Parse(PFSQLiteDatabaseResult.o)
      -[PFSQLiteDatabaseResult columnIndexIsNull:] in Parse(PFSQLiteDatabaseResult.o)
  "_sqlite3_errmsg", referenced from:
      -[PFSQLiteDatabase _errorWithErrorCode:] in Parse(PFSQLiteDatabase.o)
  "_sqlite3_finalize", referenced from:
      ___59-[PFSQLiteDatabase executeQueryAsync:withArgumentsInArray:]_block_invoke in Parse(PFSQLiteDatabase.o)
      ___57-[PFSQLiteDatabase executeSQLAsync:withArgumentsInArray:]_block_invoke in Parse(PFSQLiteDatabase.o)
      -[PFSQLiteStatement close] in Parse(PFSQLiteStatement.o)
  "_sqlite3_open", referenced from:
      ___29-[PFSQLiteDatabase openAsync]_block_invoke in Parse(PFSQLiteDatabase.o)
  "_sqlite3_prepare_v2", referenced from:
      ___59-[PFSQLiteDatabase executeQueryAsync:withArgumentsInArray:]_block_invoke in Parse(PFSQLiteDatabase.o)
      ___57-[PFSQLiteDatabase executeSQLAsync:withArgumentsInArray:]_block_invoke in Parse(PFSQLiteDatabase.o)
  "_sqlite3_reset", referenced from:
      -[PFSQLiteStatement reset] in Parse(PFSQLiteStatement.o)
  "_sqlite3_step", referenced from:
      ___57-[PFSQLiteDatabase executeSQLAsync:withArgumentsInArray:]_block_invoke in Parse(PFSQLiteDatabase.o)
      -[PFSQLiteDatabaseResult next] in Parse(PFSQLiteDatabaseResult.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

【问题讨论】:

显而易见的起点是:您是否尝试链接到 sqlite3 库?如果有,怎么做? 在 PFSQLiteDatabaseResult.o 中也有同样的错误 【参考方案1】:

经过反复试验,答案是再次检查所有框架。 似乎 parse.com 在这几个月内才进行了更新。

目前它需要 libsqlite3.dylib 作为它的库。

如果你发现类似的问题,首先在这里查看最新的需求: https://www.parse.com/apps/quickstart#parse_data/mobile/ios/native/existing

【讨论】:

以防万一 Gibran 的回答不清楚,解决方法是转到 Build Phases -> Link Binary with Library 部分并将 libsqlite3.dylib 添加到链接库列表中 请注意,现在我们有“.tbd”库。 ***.com/questions/31450690/…【参考方案2】:

我也遇到了这种情况,@Gibran 的回答让我走上了正轨。我使用 Xcode 7 和 iOS 9 发现的一个区别是 libsqlite3.dylib 已替换为 libsqlite3.tbd

【讨论】:

【参考方案3】:

我以前遇到过这个问题。只需从框架中导入libsqlite.dyliblibz.dylib,您的错误就会消失。

【讨论】:

【参考方案4】:

你可以在那里找到答案 (您需要将框架添加到您的项目中)

Link Errors with Parse.framework iOS

【讨论】:

以上是关于Apple Mach-O 链接器错误 sqlite3的主要内容,如果未能解决你的问题,请参考以下文章

Apple Mach-O 链接器错误解析

如何摆脱 Apple Mach-O 链接器错误?

Apple Mach-O 链接器错误,目标 C

ios- Apple Mach-O 链接器错误 [重复]

如何修复 Apple Mach-O 链接器错误

xCode iOS 开发 - Apple Mach-O 链接器错误 // Dsymutil 错误