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

boost::optional compilation failure on Ubuntu 16.04

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.6.1
    • Component/s: Build

      When building on Ubuntu 16.04 (gcc 5.4, boost 1.58), and passing the -DBSONCXX_POLY_USE_BOOST=1 option to CMake, the build fails like this:

      [ 21%] Building CXX object src/mongocxx/CMakeFiles/mongocxx_shared.dir/gridfs/downloader.cpp.o
      cd /home/ubuntu/mongo-cxx-driver/build/src/mongocxx && /usr/bin/c++   -DMONGOCXX_EXPORTS -DMONGO_CXX_DRIVER_COMPILING -I/include -I/home/ubuntu/mongo-cxx-driver/src/mongocxx/.. -I/home/ubuntu/mongo-cxx-driver/build/src/mongocxx/.. -isystem /usr/local/include/libmongoc-1.0 -isystem /usr/local/include/libbson-1.0 -I/home/ubuntu/mongo-cxx-driver/src/bsoncxx/.. -I/home/ubuntu/mongo-cxx-driver/build/src/bsoncxx/..  -O3 -DNDEBUG -fPIC -fvisibility=hidden -fvisibility-inlines-hidden   -std=c++11 -o CMakeFiles/mongocxx_shared.dir/gridfs/downloader.cpp.o -c /home/ubuntu/mongo-cxx-driver/src/mongocxx/gridfs/downloader.cpp
      /home/ubuntu/mongo-cxx-driver/src/mongocxx/gridfs/downloader.cpp: In member function 'void mongocxx::v_noabi::gridfs::downloader::close()':
      /home/ubuntu/mongo-cxx-driver/src/mongocxx/gridfs/downloader.cpp:80:24: error: ambiguous overload for 'operator=' (operand types are 'boost::optional<mongocxx::v_noabi::cursor>' and '<brace-enclosed initializer list>')
           _get_impl().chunks = {};
                              ^
      In file included from /home/ubuntu/mongo-cxx-driver/src/mongocxx/../bsoncxx/stdx/optional.hpp:42:0,
                       from /home/ubuntu/mongo-cxx-driver/src/mongocxx/../mongocxx/gridfs/downloader.hpp:23,
                       from /home/ubuntu/mongo-cxx-driver/src/mongocxx/gridfs/downloader.cpp:15:
      /usr/include/boost/optional/optional.hpp:922:15: note: candidate: boost::optional<T>& boost::optional<T>::operator=(const boost::optional<T>&) [with T = mongocxx::v_noabi::cursor]
           optional& operator= ( optional const& rhs )
                     ^
      /usr/include/boost/optional/optional.hpp:930:15: note: candidate: boost::optional<T>& boost::optional<T>::operator=(boost::optional<T>&&) [with T = mongocxx::v_noabi::cursor]
           optional& operator= ( optional && rhs ) 
                     ^
      /usr/include/boost/optional/optional.hpp:959:15: note: candidate: boost::optional<T>& boost::optional<T>::operator=(boost::none_t) [with T = mongocxx::v_noabi::cursor]
           optional& operator= ( none_t none_ ) BOOST_NOEXCEPT
                     ^
      src/mongocxx/CMakeFiles/mongocxx_shared.dir/build.make:686: recipe for target 'src/mongocxx/CMakeFiles/mongocxx_shared.dir/gridfs/downloader.cpp.o' failed
      make[2]: *** [src/mongocxx/CMakeFiles/mongocxx_shared.dir/gridfs/downloader.cpp.o] Error 1
      make[2]: Leaving directory '/home/ubuntu/mongo-cxx-driver/build'
      CMakeFiles/Makefile2:691: recipe for target 'src/mongocxx/CMakeFiles/mongocxx_shared.dir/all' failed
      make[1]: *** [src/mongocxx/CMakeFiles/mongocxx_shared.dir/all] Error 2
      make[1]: Leaving directory '/home/ubuntu/mongo-cxx-driver/build'
      Makefile:138: recipe for target 'all' failed
      make: *** [all] Error 2
      
      

            Assignee:
            roberto.sanchez@mongodb.com Roberto Sanchez
            Reporter:
            roberto.sanchez@mongodb.com Roberto Sanchez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: