Lord Windy
Lord Windy

Reputation: 792

unable to compile mongo-cxx-driver

From the CXX Driver Quickstart guide I've been completely unable to finish the compilation of the new driver on either a Ubuntu or CentOS VM.

I've followed the steps to the letter several time, but I'm not sure where I have gone wrong.

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)

I've redone this several times. Several times I have reinstalled the entire operating system. The error in question relates to the 1.2 development version of mongo-c-driver. I've made sure to install it, but somethign has gone wrong.

EDIT:

I don't think this will get resolved any time soon and I lack the time to really troubleshoot this. I've moved to RethinkDB instead for the time being. In a few months I'll give this a go again.

EDIT2:

Build process (after making sure that the MongoDB server is up and running)

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

EDIT 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

I've also now added the flags of my cmake build to:

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

I've now gotten more/better errors.

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
^

EDIT 4:

Updated clang to 3.6 as I thought that may fix some issues. I rebuilt libbson, libmongoc and tried again.

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

Upvotes: 1

Views: 2036

Answers (1)

Lord Windy
Lord Windy

Reputation: 792

I have found the issue.

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

MONGOC_ENABLE_SSL was set to 0 due to me not having the OpenSSL-devel packages installed. I'll raise an issue with the MongoCXX-driver developers to make sure they put that clearly on the wiki page.

Upvotes: 1

Related Questions