在CXX驱动程序快速启动指南中,我完全无法在Ubuntu或CentOS VM上完成新驱动程序的编译。
我已经跟着这封信走了好几次了,但我不知道我哪里出了问题。
In file included from /home/sam/downloads/mongo-cxx-driver/src/mongocxx/private/bulk_write.hpp:20:0,
from /home/sam/downloads/mongo-cxx-driver/src/mongocxx/bulk_write.cpp:19:
/home/sam/downloads/mongo-cxx-driver/src/mongocxx/private/libmongoc.hpp:31:63: error: ‘mongoc_client_pool_set_ssl_opts’ was not declared in this scope
#define MONGOCXX_LIBMONGOC_SYMBOL(name) constexpr auto name = mongoc_##name;
^
/home/sam/downloads/mongo-cxx-driver/src/mongocxx/private/libmongoc_symbols.hpp:42:1: note: in expansion of macro ‘MONGOCXX_LIBMONGOC_SYMBOL’
MONGOCXX_LIBMONGOC_SYMBOL(client_pool_set_ssl_opts)我已经重做过几次了。我多次重新安装了整个操作系统。所讨论的错误与mongo驱动程序的1.2开发版本有关.我已经确定要安装它,但有些地方出了问题。
编辑:
我认为这不会很快得到解决,我也没有时间真正解决这个问题。我现在已经搬到RethinkDB了。几个月后我再试一次。
EDIT2:
构建过程(确保MongoDB服务器已启动并运行后)
git clone -b 1.2.0-dev https://github.com/mongodb/mongo-c-driver
./autogen.sh
sudo make && sudo make install
git clone -b master https://github.com/mongodb/mongo-cxx-driver
cd mongo-cxx-driver/build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
sudo make && sudo make install
GCC and G++ version are 4.9.2编辑3:
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.27.1")
-- checking for module 'libbson-1.0'
-- found libbson-1.0, version 1.2.0-dev
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- checking for module 'libmongoc-1.0'
-- found libmongoc-1.0, version 1.2.0-dev
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sam/downloads/mongo-cxx-driver/build我现在还将cmake构建的标志添加到:
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C_COMPILER=/usr/bin/clang ..
clang version 3.4.2 (tags/RELEASE_34/dot2-final)
Target: x86_64-redhat-linux-gnu
Thread model: posix我现在犯了更多/更好的错误。
In file included from /home/sam/downloads/mongo-cxx-driver/src/mongocxx/private/libmongoc.hpp:32:
/home/sam/downloads/mongo-cxx-driver/src/mongocxx/private/libmongoc_symbols.hpp:42:1: error:
use of undeclared identifier 'mongoc_client_pool_set_ssl_opts'; did you
mean 'client_pool_set_ssl_opts'?
MONGOCXX_LIBMONGOC_SYMBOL(client_pool_set_ssl_opts)
^
/home/sam/downloads/mongo-cxx-driver/src/mongocxx/private/libmongoc.hpp:31:63: note:
expanded from macro 'MONGOCXX_LIBMONGOC_SYMBOL'
#define MONGOCXX_LIBMONGOC_SYMBOL(name) constexpr auto name = mongoc_##name;
^
<scratch space>:19:1: note: expanded from here
mongoc_client_pool_set_ssl_opts
^
/home/sam/downloads/mongo-cxx-driver/src/mongocxx/private/libmongoc_symbols.hpp:42:27: note:
'client_pool_set_ssl_opts' declared here
MONGOCXX_LIBMONGOC_SYMBOL(client_pool_set_ssl_opts)
^
/home/sam/downloads/mongo-cxx-driver/src/mongocxx/private/libmongoc.hpp:31:56: note:
expanded from macro 'MONGOCXX_LIBMONGOC_SYMBOL'
#define MONGOCXX_LIBMONGOC_SYMBOL(name) constexpr auto name = mongoc_##name;
^
In file included from /home/sam/downloads/mongo-cxx-driver/src/mongocxx/bulk_write.cpp:19:
In file included from /home/sam/downloads/mongo-cxx-driver/src/mongocxx/private/bulk_write.hpp:20:
In file included from /home/sam/downloads/mongo-cxx-driver/src/mongocxx/private/libmongoc.hpp:32:
/home/sam/downloads/mongo-cxx-driver/src/mongocxx/private/libmongoc_symbols.hpp:42:1: error:
variable 'client_pool_set_ssl_opts' declared with 'auto' type cannot
appear in its own initializer
MONGOCXX_LIBMONGOC_SYMBOL(client_pool_set_ssl_opts)
^
/home/sam/downloads/mongo-cxx-driver/src/mongocxx/private/libmongoc.hpp:31:63: note:
expanded from macro 'MONGOCXX_LIBMONGOC_SYMBOL'
#define MONGOCXX_LIBMONGOC_SYMBOL(name) constexpr auto name = mongoc_##name;
^
<scratch space>:19:1: note: expanded from here
mongoc_client_pool_set_ssl_opts
^编辑4:
更新的clang到3.6,因为我认为,这可能解决一些问题。我重建了libbson,libmongoc,然后再试一次。
Scanning dependencies of target mongocxx
[ 23%] Building CXX object src/mongocxx/CMakeFiles/mongocxx.dir/bulk_write.cpp.o
In file included from /home/sam/downloads/mongo-cxx-driver/src/mongocxx/bulk_write.cpp:19:
In file included from /home/sam/downloads/mongo-cxx-driver/src/mongocxx/private/bulk_write.hpp:20:
In file included from /home/sam/downloads/mongo-cxx-driver/src/mongocxx/private/libmongoc.hpp:32:
/home/sam/downloads/mongo-cxx-driver/src/mongocxx/private/libmongoc_symbols.hpp:42:1: error: use of undeclared identifier
'mongoc_client_pool_set_ssl_opts'; did you mean 'mongoc_client_pool_try_pop'?
MONGOCXX_LIBMONGOC_SYMBOL(client_pool_set_ssl_opts)
^
/home/sam/downloads/mongo-cxx-driver/src/mongocxx/private/libmongoc.hpp:31:63: note: expanded from macro
'MONGOCXX_LIBMONGOC_SYMBOL'
#define MONGOCXX_LIBMONGOC_SYMBOL(name) constexpr auto name = mongoc_##name;
^
<scratch space>:20:1: note: expanded from here
mongoc_client_pool_set_ssl_opts
^
/usr/local/include/libmongoc-1.0/mongoc-client-pool.h:45:23: note: 'mongoc_client_pool_try_pop' declared here
mongoc_client_t *mongoc_client_pool_try_pop (mongoc_client_pool_t *pool);
^
1 error generated.
make[2]: *** [src/mongocxx/CMakeFiles/mongocxx.dir/bulk_write.cpp.o] Error 1
make[1]: *** [src/mongocxx/CMakeFiles/mongocxx.dir/all] Error 2
make: *** [all] Error 2发布于 2015-10-08 04:11:28
我发现了这个问题。
#ifdef MONGOC_ENABLE_SSL
void mongoc_client_pool_set_ssl_opts (mongoc_client_pool_t *pool,
const mongoc_ssl_opt_t *opts);
#endif由于没有安装OpenSSL包,MONGOC_ENABLE_SSL被设置为0。我将向MongoCXX驱动程序开发人员提出一个问题,以确保他们在wiki页面上清楚地显示了这一点。
https://stackoverflow.com/questions/32918342
复制相似问题