Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1423

Missing include for <cassert> in tests

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.3
    • Affects Version/s: 3.1.2
    • Component/s: None
    • None

      I try to use MongoDB C Driver version 1.7.0 in Debian Stretch like described in this instruction: https://mongodb.github.io/mongo-cxx-driver/mongocxx-v3/installation
      This is was fail. But with previous version (1.6.3) everything work fine.

      How to reproduce the issue

      Step 0: To emulate my environment you can use docker. If you have't docker yet, you can install it like described here: https://docs.docker.com/engine/installation/

      Step 1: Create an empty directory, then create Dockerfile inside and copy/paste into it this content:

      FROM debian:stretch
      ADD https://github.com/mongodb/mongo-c-driver/releases/download/1.6.3/mongo-c-driver-1.6.3.tar.gz /
      ADD https://github.com/mongodb/mongo-cxx-driver/archive/r3.1.2.tar.gz /
      RUN apt-get update && \
      apt-get install -y \
      build-essential \
      cmake \
      libboost-all-dev \
      libmagick++-dev \
      libsasl2-dev \
      libssl-dev \
      pkg-config && \
      cd /mongo-c-driver-1.6.3 && \
      ./configure --disable-automatic-init-and-cleanup && \
      make && \
      make install && \
      make clean && \
      cd / && \
      cd /mongo-cxx-driver-r3.1.2/build && \
      cmake -DCMAKE_BUILD_TYPE=Release -DBSONCXX_POLY_USE_BOOST=1 -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
      make && \
      make install && \
      make clean && \
      apt-get clean

      Step 2: Build it with command
      sudo docker build . -t test

      In my case there are no error break the process (but tonns of warnings) and I succesfully got docker image with both drivers installed.

      Step 3: Switch the version by command (I change version for first driver only):
      sed -i 's/1.6.3/1.7.0/g' Dockerfile

      Step 4: Try to repeat Step 2. In my case first driver builded and installes successfully, but second driver failed to build with error:

      In file included from /mongo-cxx-driver-r3.1.2/src/mongocxx/private/libmongoc.hh:19:0,
      from /mongo-cxx-driver-r3.1.2/src/third_party/catch/include/helpers.hpp:17,
      from /mongo-cxx-driver-r3.1.2/src/mongocxx/test/bulk_write.cpp:16:
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test_util/mock.hh: In instantiation of 'void mongocxx::v_noabi::test_util::mock<R (Args ...)>::active_instance(mongocxx::v_noabi::test_util::mock<R (Args ...)>::instance*) [with R = _mongoc_bulk_operation_t*; Args =

      {bool}]':
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test_util/mock.hh:153:24: required from 'std::unique_ptr<mongocxx::v_noabi::test_util::mock<R (Args ...)>::instance> mongocxx::v_noabi::test_util::mock<R (Args ...)>::create_instance() [with R = _mongoc_bulk_operation_t*; Args = {bool}

      ]'
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test/bulk_write.cpp:30:68: required from here
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test_util/mock.hh:173:15: error: 'assert' was not declared in this scope
      assert(!current); // It is impossible to create two instances in a single thread
      ~~~~~^~~~~~~~~
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test_util/mock.hh: In instantiation of 'void mongocxx::v_noabi::test_util::mock<R (Args ...)>::active_instance(mongocxx::v_noabi::test_util::mock<R (Args ...)>::instance*) [with R = void; Args = {_mongoc_bulk_operation_t*}]':
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test_util/mock.hh:153:24: required from 'std::unique_ptr<mongocxx::v_noabi::test_util::mock<R (Args ...)>::instance> mongocxx::v_noabi::test_util::mock<R (Args ...)>::create_instance() [with R = void; Args = {_mongoc_bulk_operation_t*}]'
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test/bulk_write.cpp:57:71: required from here
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test_util/mock.hh:173:15: error: 'assert' was not declared in this scope
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test_util/mock.hh: In instantiation of 'void mongocxx::v_noabi::test_util::mock<R (Args ...)>::active_instance(mongocxx::v_noabi::test_util::mock<R (Args ...)>::instance*) [with R = void; Args = {_mongoc_bulk_operation_t*, const _bson_t*}]':
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test_util/mock.hh:153:24: required from 'std::unique_ptr<mongocxx::v_noabi::test_util::mock<R (Args ...)>::instance> mongocxx::v_noabi::test_util::mock<R (Args ...)>::create_instance() [with R = void; Args = {_mongoc_bulk_operation_t*, const _bson_t*}]'
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test/bulk_write.cpp:189:77: required from here
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test_util/mock.hh:173:15: error: 'assert' was not declared in this scope
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test_util/mock.hh: In instantiation of 'void mongocxx::v_noabi::test_util::mock<R (Args ...)>::active_instance(mongocxx::v_noabi::test_util::mock<R (Args ...)>::instance*) [with R = bool; Args = {_mongoc_bulk_operation_t*, const _bson_t*, const _bson_t*, const _bson_t*, _bson_error_t*}]':
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test_util/mock.hh:153:24: required from 'std::unique_ptr<mongocxx::v_noabi::test_util::mock<R (Args ...)>::instance> mongocxx::v_noabi::test_util::mock<R (Args ...)>::create_instance() [with R = bool; Args = {_mongoc_bulk_operation_t*, const _bson_t*, const _bson_t*, const _bson_t*, _bson_error_t*}]'
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test/bulk_write.cpp:197:91: required from here
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test_util/mock.hh:173:15: error: 'assert' was not declared in this scope
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test_util/mock.hh: In instantiation of 'void mongocxx::v_noabi::test_util::mock<R (Args ...)>::active_instance(mongocxx::v_noabi::test_util::mock<R (Args ...)>::instance*) [with R = bool; Args = {_mongoc_bulk_operation_t*, const _bson_t*, const _bson_t*, _bson_error_t*}]':
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test_util/mock.hh:153:24: required from 'std::unique_ptr<mongocxx::v_noabi::test_util::mock<R (Args ...)>::instance> mongocxx::v_noabi::test_util::mock<R (Args ...)>::create_instance() [with R = bool; Args = {_mongoc_bulk_operation_t*, const _bson_t*, const _bson_t*, _bson_error_t*}]'
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test/bulk_write.cpp:265:91: required from here
      /mongo-cxx-driver-r3.1.2/src/mongocxx/test_util/mock.hh:173:15: error: 'assert' was not declared in this scope
      make[2]: *** [src/mongocxx/test/CMakeFiles/test_driver.dir/bulk_write.cpp.o] Error 1
      src/mongocxx/test/CMakeFiles/test_driver.dir/build.make:110: recipe for target 'src/mongocxx/test/CMakeFiles/test_driver.dir/bulk_write.cpp.o' failed
      make[1]: *** [src/mongocxx/test/CMakeFiles/test_driver.dir/all] Error 2
      CMakeFiles/Makefile2:779: recipe for target 'src/mongocxx/test/CMakeFiles/test_driver.dir/all' failed
      make: *** [all] Error 2
      Makefile:138: recipe for target 'all' failed

      What's I doing wrong?

            Assignee:
            sam.rossi@mongodb.com Samuel Rossi (Inactive)
            Reporter:
            Polinux Alexander [X]
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: