[CXX-2136] boost::optional compilation failure on Ubuntu 16.04 Created: 01/Dec/20  Updated: 24/Aug/23  Resolved: 24/Aug/23

Status: Closed
Project: C++ Driver
Component/s: Build
Affects Version/s: 3.6.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Roberto Sanchez Assignee: Roberto Sanchez
Resolution: Won't Fix Votes: 0
Labels: post-5.0, size-small
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: CXX-2634

 Description   

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



 Comments   
Comment by Roberto Sanchez [ 24/Aug/23 ]

As with CXX-2137, this issue is one with a very old platform and a configuration that we do not test. Adding support for testing this particular configuration would add maintenance burden that we are not prepared to add for such an old platform.

Generated at Wed Feb 07 22:05:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.