簡體   English   中英

無法編譯mongo-cxx-driver

[英]unable to compile mongo-cxx-driver

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-c-driver的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

我發現了問題。

#ifdef MONGOC_ENABLE_SSL
void                  mongoc_client_pool_set_ssl_opts (mongoc_client_pool_t   *pool,
                                                       const mongoc_ssl_opt_t *opts);
#endif

由於我沒有安裝OpenSSL-devel軟件包,因此MONGOC_ENABLE_SSL設置為0 我將向MongoCXX驅動程序開發人員提出一個問題,以確保他們將其清楚地放在Wiki頁面上。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM