Как добавить библиотеки mongocxx в Osquery - PullRequest
0 голосов
/ 28 июня 2018

Я пытаюсь сохранить результат (JSON) запланированного запроса osqueryd в MongoDB с помощью драйвера mongocxx в рамках osquery, однако я получаю приведенную ниже ошибку при сборке исходного кода с помощью команды make

Ошибка: [83%] Встроенная цель libosquery_testing [83%] Связывание CXX исполняемого файла osquery_additional_tests /usr/local/osquery/bin/ld.lld: ошибка: неопределенный символ: mongocxx :: v_noabi :: instance :: instance ()

на которое ссылается insert_mongo.cpp: 27 (/home/tg1/osquery/osquery/logger/plugins/insert_mongo.cpp:27) / home / tg1 / osquery / build / centos7 / cache / llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497: (osquery :: startInsert (std :: __ 1 :: basic_string, std :: __ 1 :: allocator> const &))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: mongocxx::v_noabi::uri::k_default_uri
>>> referenced by view_or_value.hpp:69 (/home/tg1/osquery/include/bsoncxx/string/view_or_value.hpp:69)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert    (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: mongocxx::v_noabi::uri::uri(bsoncxx::v_noabi::string::view_or_value)
>>> referenced by insert_mongo.cpp:28 (/home/tg1/osquery/osquery/logger/plugins/insert_mongo.cpp:28)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert    (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: mongocxx::v_noabi::client::client(mongocxx::v_noabi::uri const&,     mongocxx::v_noabi::options::client const&)
>>> referenced by insert_mongo.cpp:28 (/home/tg1/osquery/osquery/logger/plugins/insert_mongo.cpp:28)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert    (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: mongocxx::v_noabi::uri::~uri()
>>> referenced by insert_mongo.cpp:28 (/home/tg1/osquery/osquery/logger/plugins/insert_mongo.cpp:28)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert    (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: bsoncxx::v_noabi::builder::core::core(bool)
>>> referenced by document.hpp:43 (/home/tg1/osquery/include/bsoncxx/builder/stream/document.hpp:43)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: mongocxx::v_noabi::client::database(bsoncxx::v_noabi::string::view_or_value) const &
>>> referenced by client.hpp:239 (/home/tg1/osquery/include/mongocxx/client.hpp:239)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert    (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: mongocxx::v_noabi::database::collection(bsoncxx::v_noabi::string::view_or_value) const
>>> referenced by database.hpp:322 (/home/tg1/osquery/include/mongocxx/database.hpp:322)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: mongocxx::v_noabi::database::~database()
>>> referenced by insert_mongo.cpp:32 (/home/tg1/osquery/osquery/logger/plugins/insert_mongo.cpp:32)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: bsoncxx::v_noabi::builder::core::key_owned(std::__1::basic_string<char,     std::__1::char_traits<char>, std::__1::allocator<char> >)
>>> referenced by key_context.hpp:84 (/home/tg1/osquery/include/bsoncxx/builder/stream/key_context.hpp:84)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: bsoncxx::v_noabi::builder::core::view_document() const
>>> referenced by document.hpp:49 (/home/tg1/osquery/include/bsoncxx/builder/stream/document.hpp:49)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: mongocxx::v_noabi::collection::insert_one    (bsoncxx::v_noabi::view_or_value<bsoncxx::v_noabi::document::view, bsoncxx::v_noabi::document::value>, mongocxx::v_noabi::options::insert const&)
>>> referenced by insert_mongo.cpp:35 (/home/tg1/osquery/osquery/logger/plugins/insert_mongo.cpp:35)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: bsoncxx::v_noabi::types::value::~value()
>>> referenced by insert_one.hpp:29 (/home/tg1/osquery/include/mongocxx/result/insert_one.hpp:29)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: bsoncxx::v_noabi::document::view::view()
>>> referenced by view_or_value.hpp:51 (/home/tg1/osquery/include/bsoncxx/view_or_value.hpp:51)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: mongocxx::v_noabi::collection::find(bsoncxx::v_noabi::view_or_value<bsoncxx::v_noabi::document::view, bsoncxx::v_noabi::document::value>, mongocxx::v_noabi::options::find const&)
>>> referenced by insert_mongo.cpp:36 (/home/tg1/osquery/osquery/logger/plugins/insert_mongo.cpp:36)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: mongocxx::v_noabi::cursor::begin()
>>> referenced by insert_mongo.cpp:38 (/home/tg1/osquery/osquery/logger/plugins/insert_mongo.cpp:38)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: mongocxx::v_noabi::cursor::end()
>>> referenced by insert_mongo.cpp:38 (/home/tg1/osquery/osquery/logger/plugins/insert_mongo.cpp:38)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert    (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: mongocxx::v_noabi::operator!=(mongocxx::v_noabi::cursor::iterator const&,         mongocxx::v_noabi::cursor::iterator const&)
>>> referenced by insert_mongo.cpp:38 (/home/tg1/osquery/osquery/logger/plugins/insert_mongo.cpp:38)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert    (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: mongocxx::v_noabi::cursor::iterator::operator*() const
>>> referenced by insert_mongo.cpp:38 (/home/tg1/osquery/osquery/logger/plugins/insert_mongo.cpp:38)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert    (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: undefined symbol: bsoncxx::v_noabi::to_json(bsoncxx::v_noabi::document::view,     bsoncxx::v_noabi::ExtendedJsonMode)
>>> referenced by insert_mongo.cpp:39 (/home/tg1/osquery/osquery/logger/plugins/insert_mongo.cpp:39)
>>>               /home/tg1/osquery/build/centos7/cache/llvmcache-6394EFF0D08516CB88568DF6DBFA8D472A356497:(osquery::startInsert        (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))

/usr/local/osquery/bin/ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [osquery/osquery_additional_tests] Error 1
make[2]: *** [osquery/CMakeFiles/osquery_additional_tests.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2

Может кто-нибудь помочь мне разобраться, как с этим справиться ...?

After adding the variable in CMakeList.txt I got the following error :                    
-- Dependent library 'mongocxx' installed locally (beware!)
-- Dependent library 'bsoncxx' installed locally (beware!)
[ 83%] Linking CXX executable osquery_additional_tests
/usr/local/osquery/bin/ld.lld: error: undefined symbol:     bsoncxx::v_noabi::builder::core::key_owned(std::__1::basic_string<char,     std::__1::char_traits<char>, std::__1::allocator<char> >)
>>> referenced by key_context.hpp:84     (/home/tg1/osquery/include/bsoncxx/builder/stream/key_context.hpp:84)
>>>                   /home/tg1/osquery/build/centos7/cache/llvmcache-    6394EFF0D08516CB88568DF6DBFA8D472A356497:    (osquery::startInsert(std::__1::basic_string<char,     std::__1::char_traits<char>, std::__1::allocator<char> > const&))
clang-6.0: error: linker command failed with exit code 1 (use -v to see     invocation)
make[3]: *** [osquery/osquery_additional_tests] Error 1
make[2]: *** [osquery/CMakeFiles/osquery_additional_tests.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2
...