title: Xcode linking issue when building with latest iOS SDK
body: <p>I've been using <a href="https://code.google.com/p/leveldb/" rel="nofollow">Google's LevelDB</a> library for my iOS app and I've been quite happy with it. Lately I migrated my whole project to the latest Xcode 5 and, while the deployment target is still iOS 6.1, the base SDK is now iOS 7. </p>
  
  <p>Everything builds fine, until it gets to the linking phase, where it fails to find leveldb's symbols for the required architecture, even though the leveldb's static library was built with the <code>-isysroot</code> option properly pointing to the iOS 7 SDK. It fails like this:</p>
  
  <pre><code>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/Uptime
  
  Undefined symbols for architecture armv7:
    "std::__1::__vector_base_common&lt;true&gt;::__throw_length_error() const", referenced from:
        void std::__1::vector&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, std::__1::allocator&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; &gt; &gt;::__push_back_slow_path&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&gt;(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;) in libleveldb.a(env_posix.o)
    "std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;::operator=(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;)", referenced from:
        leveldb::(anonymous namespace)::PosixEnv::LockFile(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;, leveldb::FileLock**) in libleveldb.a(env_posix.o)
    "std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;::__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&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;, std::__1::vector&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, std::__1::allocator&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; &gt; &gt;*) in libleveldb.a(env_posix.o)
        leveldb::(anonymous namespace)::PosixEnv::UnlockFile(leveldb::FileLock*) in libleveldb.a(env_posix.o)
    "std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;::append(char const*, unsigned long)", referenced from:
        leveldb::Status::ToString() const in libleveldb.a(status.o)
        leveldb::PutLengthPrefixedSlice(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;*, leveldb::Slice const&amp;) in libleveldb.a(coding.o)
        leveldb::(anonymous namespace)::PosixEnv::LockFile(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;, leveldb::FileLock**) in libleveldb.a(env_posix.o)
    "std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;::push_back(char)", referenced from:
        leveldb::WriteBatch::Put(leveldb::Slice const&amp;, leveldb::Slice const&amp;) in libleveldb.a(write_batch.o)
        leveldb::WriteBatch::Delete(leveldb::Slice const&amp;) in libleveldb.a(write_batch.o)
        leveldb::(anonymous namespace)::BloomFilterPolicy::CreateFilter(leveldb::Slice const*, int, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;*) const in libleveldb.a(bloom.o)
    "std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;::assign(char const*)", referenced from:
        leveldb::(anonymous namespace)::PosixEnv::GetTestDirectory(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;*) in libleveldb.a(env_posix.o)
    "std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;::~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&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;, std::__1::vector&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, std::__1::allocator&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; &gt; &gt;*) in libleveldb.a(env_posix.o)
        leveldb::(anonymous namespace)::PosixEnv::LockFile(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;, 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&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;::basic_string(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;)", referenced from:
        leveldb::Status::ToString() const in libleveldb.a(status.o)
        leveldb::(anonymous namespace)::PosixEnv::NewSequentialFile(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;, leveldb::SequentialFile**) in libleveldb.a(env_posix.o)
        leveldb::(anonymous namespace)::PosixEnv::NewRandomAccessFile(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;, leveldb::RandomAccessFile**) in libleveldb.a(env_posix.o)
        leveldb::(anonymous namespace)::PosixEnv::NewWritableFile(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;, leveldb::WritableFile**) in libleveldb.a(env_posix.o)
        leveldb::(anonymous namespace)::PosixEnv::GetChildren(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;, std::__1::vector&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, std::__1::allocator&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; &gt; &gt;*) in libleveldb.a(env_posix.o)
        std::__1::__tree&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, std::__1::less&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; &gt;, std::__1::allocator&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; &gt; &gt;::__insert_unique(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;) in libleveldb.a(env_posix.o)
        void std::__1::vector&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, std::__1::allocator&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; &gt; &gt;::__push_back_slow_path&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&gt;(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;) in libleveldb.a(env_posix.o)
        ...
    "std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;::resize(unsigned long, char)", referenced from:
        leveldb::WriteBatch::WriteBatch() in libleveldb.a(write_batch.o)
        leveldb::(anonymous namespace)::BloomFilterPolicy::CreateFilter(leveldb::Slice const*, int, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;*) const in libleveldb.a(bloom.o)
        leveldb::(anonymous namespace)::BytewiseComparatorImpl::FindShortestSeparator(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;*, leveldb::Slice const&amp;) const in libleveldb.a(comparator.o)
        leveldb::(anonymous namespace)::BytewiseComparatorImpl::FindShortSuccessor(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;*) const in libleveldb.a(comparator.o)
    "std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;::__init(char const*, unsigned long, unsigned long)", referenced from:
        leveldb::(anonymous namespace)::PosixEnv::LockFile(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;, leveldb::FileLock**) in libleveldb.a(env_posix.o)
    "leveldb::DB::Open(leveldb::Options const&amp;, std::string const&amp;, leveldb::DB**)", referenced from:
        -[LevelDB initWithPath:name:andOptions:] in libPods.a(LevelDB.o)
  ld: symbol(s) not found for architecture armv7
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>Surprisingly, linking works fine if I rebuild leveldb's static library by pointing it to an old iOS 6.1 SDK (for which I have to download Xcode 4.6, hunt for the SDK and store it somewhere on my machine).</p>
  
  <p>So, my question is, is that expected behavior? If so, why? Is it possible / what would I have to change in order to not have to keep an older version of the iOS SDK just to build this library?</p>