Two modules with the same library dependency fail to compile

I'm working on a CocoaPod that depends on two other pods i also wrote. Let's say Pod1, Pod2 and Pod3. Pod2 and Pod3 have this on their podspecs:

...
s.libraries 'sqlite3'
...

... this is because both of them use different static libraries that depend on sqlite. That line adds sqlite3 as a linked library ("Linked Frameworks and Libraries" on Build Phases) on their respective cocoapod compilation. Then, Pod1 has both of those pods as dependencies:

...
s.dependency 'Pod2'
s.dependency 'Pod3'
...

When i try to compile Pod1, this error is thrown:

Undefined symbols for architecture x86_64:
  "_sqlite3_open", referenced from:
      DatabaseConnection::open() in libSecurIDLib.a(databaseconnection.o)
  "_sqlite3_bind_int", referenced from:
      AbstractStatement::bindValue(sqlite3_stmt*, DataValue const&, int) in libSecurIDLib.a(abstractstatement.o)
  "_sqlite3_bind_double", referenced from:
      AbstractStatement::bindValue(sqlite3_stmt*, DataValue const&, int) in libSecurIDLib.a(abstractstatement.o)
  "_sqlite3_bind_text", referenced from:
      AbstractStatement::bindValue(sqlite3_stmt*, DataValue const&, int) in libSecurIDLib.a(abstractstatement.o)
  "_sqlite3_bind_blob", referenced from:
      AbstractStatement::bindValue(sqlite3_stmt*, DataValue const&, int) in libSecurIDLib.a(abstractstatement.o)
  "_sqlite3_column_double", referenced from:
      AbstractStatement::parseRow(sqlite3_stmt*) in libSecurIDLib.a(abstractstatement.o)
  "_sqlite3_bind_null", referenced from:
      AbstractStatement::bindValue(sqlite3_stmt*, DataValue const&, int) in libSecurIDLib.a(abstractstatement.o)
  "_sqlite3_column_bytes", referenced from:
      AbstractStatement::parseRow(sqlite3_stmt*) in libSecurIDLib.a(abstractstatement.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::reserve(unsigned long)", referenced from:
      KeyValueMapper::extractValue(boost::shared_ptr<KeyValuePair>) in libSecurIDLib.a(keyvaluemapper.o)
  "_sqlite3_exec", referenced from:
      CreateTableStatement::execute(DatabaseConnection*) in libSecurIDLib.a(createtablestatement.o)
      EndTransactionStatement::execute(DatabaseConnection*) in libSecurIDLib.a(endtransactionstatement.o)
      BeginTransactionStatement::execute(DatabaseConnection*) in libSecurIDLib.a(begintransactionstatement.o)
  "_sqlite3_finalize", referenced from:
      AbstractStatement::takeStepsAndFinalize(sqlite3_stmt*) in libSecurIDLib.a(abstractstatement.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*)", referenced from:
      TokenMapper::convertDate(CK_DATE const&) in libSecurIDLib.a(tokenmapper.o)
      SqlStrings::generateInsertStatement(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int) in libSecurIDLib.a(sqlstrings.o)
      SqlStrings::generateCreateTableStatement(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, boost::shared_ptr<std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, DataValue::SQL_DATATYPE>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, DataValue::SQL_DATATYPE> > > >) in libSecurIDLib.a(sqlstrings.o)
      SqlStrings::generateDeleteStatement(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libSecurIDLib.a(sqlstrings.o)
      SqlStrings::generateSelectStatement(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libSecurIDLib.a(sqlstrings.o)
      SqlStrings::generateUpdateStatement(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, boost::shared_ptr<std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, DataValue>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, DataValue> > > >) in libSecurIDLib.a(sqlstrings.o)
  "vtable for __cxxabiv1::__vmi_class_type_info", referenced from:
      typeinfo for RSA::Crypto::BSAFE_Recode in libSecurIDLib.a(BSAFE_Recode.o)
      typeinfo for RSA::Crypto::BSAFE_SecretKey in libSecurIDLib.a(BSAFE_CryptoKey.o)
      typeinfo for RSA::Crypto::BSAFE_PublicKey in libSecurIDLib.a(BSAFE_CryptoKey.o)
      typeinfo for RSA::Crypto::BSAFE_PrivateKey in libSecurIDLib.a(BSAFE_CryptoKey.o)
      typeinfo for RSA::Crypto::BSAFE_CryptoHash in libSecurIDLib.a(BSAFE_CryptoHash.o)
      typeinfo for RSA::Crypto::BSAFE_SymmetricCipher in libSecurIDLib.a(BSAFE_SymmetricCipher.o)

some more errors that don't fit here because of the word limit, and then finishes with:

      ...
  "_xmlSchemaCleanupTypes", referenced from:
      -[yqKtL17 validateTdpUsingXsd:] in libSecurIDLib.a(TdpProcessor.o)
  "___cxa_guard_release", referenced from:
      SecLibMesState::instance() in libSecurIDLib.a(SecLibMesState.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What are my options? I tried to publish sqlite3 in a separate, shared pod, but it neither of both libraries take it

728x90

1 Answers Two modules with the same library dependency fail to compile

Make sure that the podspec specifies sqlite3 as a system library dependency:

s.library = 'sqlite3'

2 weeks ago