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

Failed to compile version 3.4.0 with gcc 7.4.0 and C++17

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.0
    • Component/s: Build
    • None
    • Environment:
      Ubuntu 18.04.1 LTS
      gcc version 7.4.0

      Hi.

      I'm trying to build mongocxx version 3.4.0 with C++17 enabled but there is an error during compilation.

      I'm using libmongoc: https://github.com/mongodb/mongo-c-driver/releases/download/1.13.0/mongo-c-driver-1.13.0.tar.gz

      I've used following command for cmake:

      cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_CXX_STANDARD=17 ..
      
      -- The CXX compiler identification is GNU 7.4.0
      
      -- Check for working CXX compiler: /usr/bin/c++
      
      -- Check for working CXX compiler: /usr/bin/c++ -- works
      
      -- Detecting CXX compiler ABI info
      
      -- Detecting CXX compiler ABI info - done
      
      -- Detecting CXX compile features
      
      -- Detecting CXX compile features - done
      
      -- The C compiler identification is GNU 7.4.0
      
      -- Check for working C compiler: /usr/bin/cc
      
      -- Check for working C compiler: /usr/bin/cc -- works
      
      -- Detecting C compiler ABI info
      
      -- Detecting C compiler ABI info - done
      
      -- Detecting C compile features
      
      -- Detecting C compile features - done
      
      -- Auto-configuring bsoncxx to use C++17 std library polyfills since C++17 is active and user didn't specify otherwise
      
      -- 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
      
      -- Looking for C++ include pthread.h
      
      -- Looking for C++ include pthread.h - found
      
      -- Looking for pthread_create
      
      -- Looking for pthread_create - not found
      
      -- Check if compiler accepts -pthread
      
      -- Check if compiler accepts -pthread - yes
      
      -- Found Threads: TRUE   
      -- Configuring done
      
      -- Generating done
      
      -- Build files have been written to: /home/rmilczar/work/gameserver/env_files/mongo-cxx-driver-r3.4.0/build
      
      

       

      Scanning dependencies of target mongocxx_mocked [ 14%] Building CXX object src/mongocxx/CMakeFiles/mongocxx_mocked.dir/bulk_write.cpp.o In file included from /home/rmilczar/work/gameserver/env_files/mongo-cxx-driver-r3.4.0/src/mongocxx/private/client_session.hh:24:0,                 from /home/rmilczar/work/gameserver/env_files/mongo-cxx-driver-r3.4.0/src/mongocxx/bulk_write.cpp:25: /home/rmilczar/work/gameserver/env_files/mongo-cxx-driver-r3.4.0/src/mongocxx/options/private/transaction.hh: In member function ‘std::optional<mongocxx::v_noabi::read_concern> mongocxx::v_noabi::options::transa ction::impl::read_concern() const’: /home/rmilczar/work/gameserver/env_files/mongo-cxx-driver-r3.4.0/src/mongocxx/options/private/transaction.hh:64:88: error: could not convert ‘{std::make_unique(_Args&& ...) [with _Tp = mongocxx::v_noabi::read_co ncern::impl; _Args = {_mongoc_read_concern_t*}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptr<mongocxx::v_noabi::read_concern::impl>]()}’ from ‘<brace-enclosed initializer list>’ to ‘std::optio nal<mongocxx::v_noabi::read_concern>’         return {stdx::make_unique<read_concern::impl>(libmongoc::read_concern_copy(rc))};                                                                                        ^ /home/rmilczar/work/gameserver/env_files/mongo-cxx-driver-r3.4.0/src/mongocxx/options/private/transaction.hh: In member function ‘std::optional<mongocxx::v_noabi::write_concern> mongocxx::v_noabi::options::trans action::impl::write_concern() const’: /home/rmilczar/work/gameserver/env_files/mongo-cxx-driver-r3.4.0/src/mongocxx/options/private/transaction.hh:77:90: error: could not convert ‘{std::make_unique(_Args&& ...) [with _Tp = mongocxx::v_noabi::write_c oncern::impl; _Args = {_mongoc_write_concern_t*}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptr<mongocxx::v_noabi::write_concern::impl>]()}’ from ‘<brace-enclosed initializer list>’ to ‘std::op tional<mongocxx::v_noabi::write_concern>’         return {stdx::make_unique<write_concern::impl>(libmongoc::write_concern_copy(wc))};                                                                                          ^ /home/rmilczar/work/gameserver/env_files/mongo-cxx-driver-r3.4.0/src/mongocxx/options/private/transaction.hh: In member function ‘std::optional<mongocxx::v_noabi::read_preference> mongocxx::v_noabi::options::tra nsaction::impl::read_preference() const’: /home/rmilczar/work/gameserver/env_files/mongo-cxx-driver-r3.4.0/src/mongocxx/options/private/transaction.hh:90:89: error: could not convert ‘{std::make_unique(_Args&& ...) [with _Tp = mongocxx::v_noabi::read_pr eference::impl; _Args = {_mongoc_read_prefs_t*}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptr<mongocxx::v_noabi::read_preference::impl>]()}’ from ‘<brace-enclosed initializer list>’ to ‘std::o ptional<mongocxx::v_noabi::read_preference>’         return {stdx::make_unique<read_preference::impl>(libmongoc::read_prefs_copy(rp))};                                                                                         ^ src/mongocxx/CMakeFiles/mongocxx_mocked.dir/build.make:62: recipe for target 'src/mongocxx/CMakeFiles/mongocxx_mocked.dir/bulk_write.cpp.o' failed make[2]: *** [src/mongocxx/CMakeFiles/mongocxx_mocked.dir/bulk_write.cpp.o] Error 1 CMakeFiles/Makefile2:627: recipe for target 'src/mongocxx/CMakeFiles/mongocxx_mocked.dir/all' failed make[1]: *** [src/mongocxx/CMakeFiles/mongocxx_mocked.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2
      

       

      Compiling without DCMAKE_CXX_STANDARD=17 works correctly.

            Assignee:
            Unassigned Unassigned
            Reporter:
            milczarek.r@gmail.com Rafał Milczarek
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: