我使用xcode和libsqlite3.dylib for 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)
但是项目成功编译到模拟器,当我将项目编译到真实设备时发生错误。
答案 0 :(得分:37)
查看是否已将libsqlite3.dylib添加到所有目标。
答案 1 :(得分:8)
最后我发现了问题:libsqlite3.dylib,我使用的编译为armv6而不是7,所以我只需下载xcode dmg文件4.3并从中提取lib。
答案 2 :(得分:0)
对于那些在Xcode 4.5.1中验证应用程序存档时收到此消息的人 - 存在一个已知问题,即Xcode无法正确处理包含非字母字符的产品名称。也就是说,在取出Product Name
构建设置的所有非字母字符之后,问题就消失了。