缺少所需的架构 armv7

Posted

技术标签:

【中文标题】缺少所需的架构 armv7【英文标题】:missing required architecture armv7 【发布时间】:2012-04-03 11:58:36 【问题描述】:

我将 xcode 与 libsqlite3.dylib 一起用于 sqlite,但是当我编译到设备时出现以下错误:

Ld /Users/user1319/Library/Developer/Xcode/DerivedData/Directory-app normal armv7
    cd /Users/user1319/Desktop/app/app

    setenv IPHONEOS_DEPLOYMENT_TARGET 5.0
    setenv PATH "/Developer/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Developer/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -L/Users/user1319/Library/Developer/Xcode/DerivedData/app_Directory-bnkhohrmxdhrusarswxeqvxlljct/Build/Products/Distribution-iphoneos -F/Users/user1319/Library/Developer/Xcode/DerivedData/app-bnkhohrmxdhrusarswxeqvxlljct/Build/Products/Distribution-iphoneos -filelist "/Users/user1319/Library/Developer/Xcode/DerivedData/app-bnkhohrmxdhrusarswxeqvxlljct/Build/Intermediates/app Directory.build/Distribution-iphoneos/app.build/Objects-normal/armv7/app.LinkFileList" -Xlinker -rpath -Xlinker / -dead_strip -miphoneos-version-min=5.0 -lsqlite3 -lsqlite3.0 -framework AddressBook -framework AddressBookUI -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/user1319/Library/Developer/Xcode/DerivedData/app-bnkhohrmxdhrusarswxeqvxlljct/Build/Products/Distribution-iphoneos/app.app/app

ld: warning: ignoring file /Developer/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/libsqlite3.dylib, missing required architecture armv7 in file
ld: warning: ignoring file /Developer/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/libsqlite3.0.dylib, missing required architecture armv7 in file
Undefined symbols for architecture armv7:
  "_sqlite3_reset", referenced from:
      -[FMDatabase executeUpdate:error:withArgumentsInArray:orVAList:] in FMDatabase.o
      -[FMStatement reset] in FMDatabase.o
      -[FMResultSet next] in FMResultSet.o
  "_sqlite3_bind_blob", referenced from:
      -[FMDatabase bindObject:toColumn:inStatement:] in FMDatabase.o
  "_sqlite3_changes", referenced from:
      -[FMDatabase changes] in FMDatabase.o
  "_sqlite3_prepare_v2", referenced from:
      -[FMDatabase executeQuery:withArgumentsInArray:orVAList:] in FMDatabase.o
      -[FMDatabase executeUpdate:error:withArgumentsInArray:orVAList:] in FMDatabase.o
      -[FMDatabase(FMDatabaseAdditions) validateSQL:error:] in FMDatabaseAdditions.o
  "_sqlite3_open", referenced from:
      -[FMDatabase open] in FMDatabase.o
  "_sqlite3_open_v2", referenced from:
      -[FMDatabase openWithFlags:] in FMDatabase.o
  "_sqlite3_bind_text", referenced from:
      -[FMDatabase bindObject:toColumn:inStatement:] in FMDatabase.o
  "_sqlite3_step", referenced from:
      -[FMDatabase executeUpdate:error:withArgumentsInArray:orVAList:] in FMDatabase.o
      -[FMResultSet next] in FMResultSet.o
  "_sqlite3_next_stmt", referenced from:
      -[FMDatabase close] in FMDatabase.o
  "_sqlite3_bind_double", referenced from:
      -[FMDatabase bindObject:toColumn:inStatement:] in FMDatabase.o
  "_sqlite3_threadsafe", referenced from:
      +[FMDatabase isThreadSafe] in FMDatabase.o
  "_sqlite3_bind_int", referenced from:
      -[FMDatabase bindObject:toColumn:inStatement:] in FMDatabase.o
  "_sqlite3_last_insert_rowid", referenced from:
      -[FMDatabase lastInsertRowId] in FMDatabase.o
  "_sqlite3_column_blob", referenced from:
      -[FMResultSet dataForColumnIndex:] in FMResultSet.o
      -[FMResultSet dataNoCopyForColumnIndex:] in FMResultSet.o
  "_sqlite3_finalize", referenced from:
      -[FMDatabase close] in FMDatabase.o
      -[FMDatabase executeQuery:withArgumentsInArray:orVAList:] in FMDatabase.o
      -[FMDatabase executeUpdate:error:withArgumentsInArray:orVAList:] in FMDatabase.o
      -[FMStatement close] in FMDatabase.o
      -[FMDatabase(FMDatabaseAdditions) validateSQL:error:] in FMDatabaseAdditions.o
  "_sqlite3_column_text", referenced from:
      -[FMResultSet kvcMagic:] in FMResultSet.o
      -[FMResultSet stringForColumnIndex:] in FMResultSet.o
      -[FMResultSet UTF8StringForColumnIndex:] in FMResultSet.o
  "_sqlite3_column_bytes", referenced from:
      -[FMResultSet dataForColumnIndex:] in FMResultSet.o
      -[FMResultSet dataNoCopyForColumnIndex:] in FMResultSet.o
  "_sqlite3_column_int64", referenced from:
      -[FMResultSet longForColumnIndex:] in FMResultSet.o
      -[FMResultSet longLongIntForColumnIndex:] in FMResultSet.o
  "_sqlite3_bind_parameter_count", referenced from:
      -[FMDatabase executeQuery:withArgumentsInArray:orVAList:] in FMDatabase.o
      -[FMDatabase executeUpdate:error:withArgumentsInArray:orVAList:] in FMDatabase.o
  "_sqlite3_column_count", referenced from:
      -[FMResultSet columnCount] in FMResultSet.o
      -[FMResultSet setupColumnNames] in FMResultSet.o
      -[FMResultSet kvcMagic:] in FMResultSet.o
  "_sqlite3_column_name", referenced from:
      -[FMResultSet setupColumnNames] in FMResultSet.o
      -[FMResultSet kvcMagic:] in FMResultSet.o
      -[FMResultSet columnNameForIndex:] in FMResultSet.o
  "_sqlite3_errmsg", referenced from:
      -[FMDatabase lastErrorMessage] in FMDatabase.o
      -[FMDatabase executeUpdate:error:withArgumentsInArray:orVAList:] in FMDatabase.o
      -[FMResultSet next] in FMResultSet.o
  "_sqlite3_column_type", referenced from:
      -[FMResultSet stringForColumnIndex:] in FMResultSet.o
      -[FMResultSet dateForColumnIndex:] in FMResultSet.o
      -[FMResultSet dataForColumnIndex:] in FMResultSet.o
      -[FMResultSet dataNoCopyForColumnIndex:] in FMResultSet.o
      -[FMResultSet columnIndexIsNull:] in FMResultSet.o
      -[FMResultSet UTF8StringForColumnIndex:] in FMResultSet.o
      -[FMResultSet objectForColumnIndex:] in FMResultSet.o
      ...
  "_sqlite3_libversion", referenced from:
      +[FMDatabase sqliteLibVersion] in FMDatabase.o
  "_sqlite3_errcode", referenced from:
      -[FMDatabase lastErrorCode] in FMDatabase.o
      -[FMResultSet hasAnotherRow] in FMResultSet.o
  "_sqlite3_column_int", referenced from:
      -[FMResultSet intForColumnIndex:] in FMResultSet.o
  "_sqlite3_close", referenced from:
      -[FMDatabase close] in FMDatabase.o
  "_sqlite3_column_double", referenced from:
      -[FMResultSet doubleForColumnIndex:] in FMResultSet.o
  "_sqlite3_data_count", referenced from:
      -[FMResultSet resultDict] in FMResultSet.o
  "_sqlite3_bind_int64", referenced from:
      -[FMDatabase bindObject:toColumn:inStatement:] in FMDatabase.o
  "_sqlite3_bind_null", referenced from:
      -[FMDatabase bindObject:toColumn:inStatement:] in FMDatabase.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

但是项目成功编译到模拟器,当我将项目编译到真实设备时发生错误。

【问题讨论】:

【参考方案1】:

查看是否将 libsqlite3.dylib 添加到所有目标中。

【讨论】:

【参考方案2】:

最后我发现了问题:我使用的 libsqlite3.dylib 是为 armv6 而不是 7 编译的,所以我只需下载 xcode dmg 文件 4.3 并从中提取 lib。

【讨论】:

【参考方案3】:

对于那些在 Xcode 4.5.1 中验证应用存档时收到此消息的人 - 存在一个已知问题,阻止 Xcode 正确处理包含非字母字符的产品名称。也就是说,在我去掉所有非字母字符 Product Name 构建设置后,问题就消失了。

【讨论】:

以上是关于缺少所需的架构 armv7的主要内容,如果未能解决你的问题,请参考以下文章

XCode 4.3.2 应用程序可执行文件缺少所需的架构。以下armv7至少之一

Zbar SDK - 缺少所需的架构 x86_64

应用程序可执行文件缺少所需的体系结构。至少以下 armv7 之一

缺少所需的架构 arm64

在使用 CodeSign 进行最终运行时“缺少所需的架构”

Kotlin 多平台移动 - 无法运行 iOS 项目 - 缺少此目标所需的一个或多个架构