使用最新的iOS SDK构建时Xcode链接问题

使用最新的iOS SDK构建时Xcode链接问题,第1张

概述我一直在为我的iOS应用程序使用 Google’s LevelDB库,我对此非常满意.最近我将整个项目迁移到最新的Xcode 5,虽然部署目标仍然是iOS 6.1,但基本SDK现在是iOS 7. 一切都很好,直到它进入链接阶段,在那里它找不到所需架构的leveldb符号,即使leveldb的静态库是使用-isysroot选项正确指向iOS 7 SDK构建的.它失败了: Ld /Users/math 我一直在为我的iOS应用程序使用 Google’s LevelDB库,我对此非常满意.最近我将整个项目迁移到最新的Xcode 5,虽然部署目标仍然是iOS 6.1,但基本SDK现在是iOS 7.

一切都很好,直到它进入链接阶段,在那里它找不到所需架构的leveldb符号,即使leveldb的静态库是使用-isysroot选项正确指向iOS 7 SDK构建的.它失败了:

Ld /Users/mathIEudamours/Development/storm/iOS/Uptime/Build/Intermediates/Uptime.build/Release-iphoneos/Uptime.build/Objects-normal/armv7/Uptime normal armv7    cd /Users/mathIEudamours/Development/storm/iOS/Uptime/Uptime    setenv IPHONEOS_DEPLOYMENT_TARGET 6.1    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -L/Users/mathIEudamours/Development/storm/iOS/Uptime/Build/Products/Release-iphoneos -L/Users/mathIEudamours/Development/storm/iOS/Uptime/Uptime/../Pods/Objective-LevelDB/leveldb-library -F/Users/mathIEudamours/Development/storm/iOS/Uptime/Build/Products/Release-iphoneos -F/Users/mathIEudamours/Development/storm/iOS/Common/HockeySDK.embeddedframework -fileList /Users/mathIEudamours/Development/storm/iOS/Uptime/Build/Intermediates/Uptime.build/Release-iphoneos/Uptime.build/Objects-normal/armv7/Uptime.linkfileList -dead_strip -ObjC -fobjc-arc -Wl,-no_compact_unwind -licucore -lleveldb -lstdc++ -framework Accelerate -framework CFNetwork -framework CoreGraphics -framework MessageUI -framework MobileCoreServices -framework QuartzCore -framework Security -framework SystemConfiguration -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.1 -framework SystemConfiguration -framework QuartzCore -framework CoreText -framework EventKit -framework UIKit -framework HockeySDK -framework Foundation -framework CoreGraphics -lPods -Xlinker -dependency_info -Xlinker /Users/mathIEudamours/Development/storm/iOS/Uptime/Build/Intermediates/Uptime.build/Release-iphoneos/Uptime.build/Objects-normal/armv7/Uptime_dependency_info.dat -o /Users/mathIEudamours/Development/storm/iOS/Uptime/Build/Intermediates/Uptime.build/Release-iphoneos/Uptime.build/Objects-normal/armv7/UptimeUndefined symbols for architecture armv7:  "std::__1::__vector_base_common<true>::__throw_length_error() const",referenced from:      voID std::__1::vector<std::__1::basic_string<char,std::__1::char_traits<char>,std::__1::allocator<char> >,std::__1::allocator<std::__1::basic_string<char,std::__1::allocator<char> > > >::__push_back_slow_path<std::__1::basic_string<char,std::__1::allocator<char> > const>(std::__1::basic_string<char,std::__1::allocator<char> > const&) in libleveldb.a(env_posix.o)  "std::__1::basic_string<char,std::__1::allocator<char> >::operator=(std::__1::basic_string<char,std::__1::allocator<char> > const&)",referenced from:      leveldb::(anonymous namespace)::PosixEnv::Lockfile(std::__1::basic_string<char,std::__1::allocator<char> > const&,leveldb::fileLock**) in libleveldb.a(env_posix.o)  "std::__1::basic_string<char,std::__1::allocator<char> >::__init(char const*,unsigned long)",referenced from:      leveldb::Status::ToString() const in libleveldb.a(status.o)      leveldb::(anonymous namespace)::PosixEnv::GetChildren(std::__1::basic_string<char,std::__1::vector<std::__1::basic_string<char,std::__1::allocator<char> > > >*) in libleveldb.a(env_posix.o)      leveldb::(anonymous namespace)::PosixEnv::Unlockfile(leveldb::fileLock*) in libleveldb.a(env_posix.o)  "std::__1::basic_string<char,std::__1::allocator<char> >::append(char const*,referenced from:      leveldb::Status::ToString() const in libleveldb.a(status.o)      leveldb::PutLengthPrefixedSlice(std::__1::basic_string<char,std::__1::allocator<char> >*,leveldb::Slice const&) in libleveldb.a(Coding.o)      leveldb::(anonymous namespace)::PosixEnv::Lockfile(std::__1::basic_string<char,std::__1::allocator<char> >::push_back(char)",referenced from:      leveldb::WriteBatch::Put(leveldb::Slice const&,leveldb::Slice const&) in libleveldb.a(write_batch.o)      leveldb::WriteBatch::Delete(leveldb::Slice const&) in libleveldb.a(write_batch.o)      leveldb::(anonymous namespace)::BloomFilterPolicy::CreateFilter(leveldb::Slice const*,int,std::__1::basic_string<char,std::__1::allocator<char> >*) const in libleveldb.a(bloom.o)  "std::__1::basic_string<char,std::__1::allocator<char> >::assign(char const*)",referenced from:      leveldb::(anonymous namespace)::PosixEnv::GetTestDirectory(std::__1::basic_string<char,std::__1::allocator<char> >*) in libleveldb.a(env_posix.o)  "std::__1::basic_string<char,std::__1::allocator<char> >::~basic_string()",referenced from:      leveldb::WriteBatch::WriteBatch() in libleveldb.a(write_batch.o)      leveldb::WriteBatch::~WriteBatch() in libleveldb.a(write_batch.o)      leveldb::Status::ToString() const in libleveldb.a(status.o)      leveldb::(anonymous namespace)::PosixEnv::GetChildren(std::__1::basic_string<char,std::__1::allocator<char> > > >*) in libleveldb.a(env_posix.o)      leveldb::(anonymous namespace)::PosixEnv::Lockfile(std::__1::basic_string<char,leveldb::fileLock**) in libleveldb.a(env_posix.o)      leveldb::(anonymous namespace)::PosixEnv::Unlockfile(leveldb::fileLock*) in libleveldb.a(env_posix.o)      leveldb::(anonymous namespace)::PosixfileLock::~PosixfileLock() in libleveldb.a(env_posix.o)      ...  "std::__1::basic_string<char,std::__1::allocator<char> >::basic_string(std::__1::basic_string<char,referenced from:      leveldb::Status::ToString() const in libleveldb.a(status.o)      leveldb::(anonymous namespace)::PosixEnv::NewSequentialfile(std::__1::basic_string<char,leveldb::Sequentialfile**) in libleveldb.a(env_posix.o)      leveldb::(anonymous namespace)::PosixEnv::NewRandomAccessfile(std::__1::basic_string<char,leveldb::RandomAccessfile**) in libleveldb.a(env_posix.o)      leveldb::(anonymous namespace)::PosixEnv::NewWritablefile(std::__1::basic_string<char,leveldb::Writablefile**) in libleveldb.a(env_posix.o)      leveldb::(anonymous namespace)::PosixEnv::GetChildren(std::__1::basic_string<char,std::__1::allocator<char> > > >*) in libleveldb.a(env_posix.o)      std::__1::__tree<std::__1::basic_string<char,std::__1::less<std::__1::basic_string<char,std::__1::allocator<char> > >,std::__1::allocator<char> > > >::__insert_unique(std::__1::basic_string<char,std::__1::allocator<char> > const&) in libleveldb.a(env_posix.o)      voID std::__1::vector<std::__1::basic_string<char,std::__1::allocator<char> > const&) in libleveldb.a(env_posix.o)      ...  "std::__1::basic_string<char,std::__1::allocator<char> >::resize(unsigned long,char)",referenced from:      leveldb::WriteBatch::WriteBatch() in libleveldb.a(write_batch.o)      leveldb::(anonymous namespace)::BloomFilterPolicy::CreateFilter(leveldb::Slice const*,std::__1::allocator<char> >*) const in libleveldb.a(bloom.o)      leveldb::(anonymous namespace)::BytewiseComparatorImpl::FindShortestSeparator(std::__1::basic_string<char,leveldb::Slice const&) const in libleveldb.a(comparator.o)      leveldb::(anonymous namespace)::BytewiseComparatorImpl::FindShortSuccessor(std::__1::basic_string<char,std::__1::allocator<char> >*) const in libleveldb.a(comparator.o)  "std::__1::basic_string<char,unsigned long,leveldb::fileLock**) in libleveldb.a(env_posix.o)  "leveldb::DB::Open(leveldb::Options const&,std::string const&,leveldb::DB**)",referenced from:      -[LevelDB initWithPath:name:andOptions:] in libPods.a(LevelDB.o)ld: symbol(s) not found for architecture armv7clang: error: linker command Failed with exit code 1 (use -v to see invocation)

令人惊讶的是,如果我通过将leveldb的静态库指向一个旧的iOS 6.1 SDK(我必须下载Xcode 4.6,寻找SDK并将其存储在我的机器上的某个地方)来重建链接工作正常.

那么,我的问题是,这是预期的行为吗?如果是这样,为什么?是否有可能/为了不必保留iOS SDK的旧版本来构建此库,我需要更改什么?

解决方法 您链接到的标准C库不匹配. Apple的LLVM使用libc,而较旧的版本使用libstdc.您显示的符号是libc符号.

如果编译器,代码样式和标准库的构建设置在库和应用程序之间相同,那么您应该没问题.

总结

以上是内存溢出为你收集整理的使用最新的iOS SDK构建时Xcode链接问题全部内容,希望文章能够帮你解决使用最新的iOS SDK构建时Xcode链接问题所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1000290.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存