具有相同库依赖关系的两个模块无法编译

时间:2018-11-30 17:38:30

标签: xcode cocoapods xcodebuild

我正在研究一个CocoaPod,它也依赖于我也写的另外两个Pod。假设Pod1,Pod2和Pod3。 Pod2和Pod3在其podspec上具有以下功能:

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

...这是因为它们两个都使用依赖于sqlite的不同静态库。该行在其各自的cocoapod编译中将sqlite3添加为链接库(在构建阶段为“ Linked Frameworks and Libraries”)。 然后,Pod1将这两个Pod都作为依赖项:

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

当我尝试编译Pod1时,抛出此错误:

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)

由于字数限制,一些在这里不适合的错误,然后以:

结尾
      ...
  "_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)

我有什么选择?我尝试publish sqlite3在一个单独的共享窗格中,但是两个库都不接受它

1 个答案:

答案 0 :(得分:0)

确保podspec将sqlite3指定为系统库依赖项:

  

s.library ='sqlite3'