I’ve compiled my application with gcc 9.4.0 on Ubuntu 20.04 successfully. But with gcc 7.2.1 on Amazon Linux 2 it logs the following error:
Mongo-cxx-driver version: 3.6.5
In file included from /usr/include/c++/7/x86_64-amazon-linux/bits/c++allocator.h:33:0,
from /usr/include/c++/7/bits/allocator.h:46,
from /usr/include/c++/7/string:41,
from /usr/include/c++/7/stdexcept:39,
from /usr/include/c++/7/array:39,
from /usr/include/c++/7/tuple:39,
from /usr/include/c++/7/mutex:38,
from /home/lstorino/psrplot/src/mongo.h:6,
from /home/lstorino/psrplot/src/mongo.cpp:1:
/usr/include/c++/7/ext/new_allocator.h: In instantiation of ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::pair<const std::basic_string<char>, mongocxx::v_noabi::client>; _Args = {const std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, mongocxx::v_noabi::client>&}; _Tp = std::pair<const std::basic_string<char>, mongocxx::v_noabi::client>]’:
/usr/include/c++/7/bits/alloc_traits.h:475:4: required from ‘static void std::allocator_traits<std::allocator<_CharT> >::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, _Up*, _Args&& ...) [with _Up = std::pair<const std::basic_string<char>, mongocxx::v_noabi::client>; _Args = {const std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, mongocxx::v_noabi::client>&}; _Tp = std::pair<const std::basic_string<char>, mongocxx::v_noabi::client>; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocator<std::pair<const std::basic_string<char>, mongocxx::v_noabi::client> >]’
/usr/include/c++/7/bits/hashtable_policy.h:2066:37: required from ‘std::__detail::_Hashtable_alloc<_NodeAlloc>::__node_type* std::__detail::_Hashtable_alloc<_NodeAlloc>::_M_allocate_node(_Args&& ...) [with _Args = {const std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, mongocxx::v_noabi::client>&}; _NodeAlloc = std::allocator<std::__detail::_Hash_node<std::pair<const std::basic_string<char>, mongocxx::v_noabi::client>, true> >; std::__detail::_Hashtable_alloc<_NodeAlloc>::__node_type = std::__detail::_Hash_node<std::pair<const std::basic_string<char>, mongocxx::v_noabi::client>, true>]’
/usr/include/c++/7/bits/hashtable_policy.h:182:58: required from ‘std::__detail::_AllocNode<_NodeAlloc>::__node_type* std::__detail::_AllocNode<_NodeAlloc>::operator()(_Arg&&) const [with _Arg = const std::pair<const std::basic_string<char>, mongocxx::v_noabi::client>&; _NodeAlloc = std::allocator<std::__detail::_Hash_node<std::pair<const std::basic_string<char>, mongocxx::v_noabi::client>, true> >; std::__detail::_AllocNode<_NodeAlloc>::__node_type = std::__detail::_Hash_node<std::pair<const std::basic_string<char>, mongocxx::v_noabi::client>, true>]’
/usr/include/c++/7/bits/hashtable.h:1818:18: required from ‘std::pair<typename std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, _Traits>::iterator, bool> std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_M_insert(_Arg&&, const _NodeGenerator&, std::true_type) [with _Arg = const std::pair<const std::basic_string<char>, mongocxx::v_noabi::client>&; _NodeGenerator = std::__detail::_AllocNode<std::allocator<std::__detail::_Hash_node<std::pair<const std::basic_string<char>, mongocxx::v_noabi::client>, true> > >; _Key = std::basic_string<char>; _Value = std::pair<const std::basic_string<char>, mongocxx::v_noabi::client>; _Alloc = std::allocator<std::pair<const std::basic_string<char>, mongocxx::v_noabi::client> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::basic_string<char> >; _H1 = std::hash<std::basic_string<char> >; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>; typename std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, _Traits>::iterator = std::__detail::_Node_iterator<std::pair<const std::basic_string<char>, mongocxx::v_noabi::client>, false, true>; std::true_type = std::integral_constant<bool, true>]’
/usr/include/c++/7/bits/hashtable_policy.h:843:55: required from ‘std::__detail::_Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::__ireturn_type std::__detail::_Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::insert(const value_type&) [with _Key = std::basic_string<char>; _Value = std::pair<const std::basic_string<char>, mongocxx::v_noabi::client>; _Alloc = std::allocator<std::pair<const std::basic_string<char>, mongocxx::v_noabi::client> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::basic_string<char> >; _H1 = std::hash<std::basic_string<char> >; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>; std::__detail::_Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::__ireturn_type = std::pair<std::__detail::_Node_iterator<std::pair<const std::basic_string<char>, mongocxx::v_noabi::client>, false, true>, bool>; std::__detail::_Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::value_type = std::pair<const std::basic_string<char>, mongocxx::v_noabi::client>]’
/usr/include/c++/7/bits/unordered_map.h:579:31: required from ‘std::pair<typename std::_Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc, std::__detail::_Select1st, _Pred, _Hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<std::__not_<std::__and_<std::__is_fast_hash<_Hash>, std::__detail::__is_noexcept_hash<_Key, _Hash> > >::value, false, true> >::iterator, bool> std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(const value_type&) [with _Key = std::basic_string<char>; _Tp = mongocxx::v_noabi::client; _Hash = std::hash<std::basic_string<char> >; _Pred = std::equal_to<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, mongocxx::v_noabi::client> >; typename std::_Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc, std::__detail::_Select1st, _Pred, _Hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<std::__not_<std::__and_<std::__is_fast_hash<_Hash>, std::__detail::__is_noexcept_hash<_Key, _Hash> > >::value, false, true> >::iterator = std::__detail::_Node_iterator<std::pair<const std::basic_string<char>, mongocxx::v_noabi::client>, false, true>; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::value_type = std::pair<const std::basic_string<char>, mongocxx::v_noabi::client>]’
/home/lstorino/psrplot/src/mongo.cpp:90:73: required from here
/usr/include/c++/7/ext/new_allocator.h:136:4: error: use of deleted function ‘std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&) [with _T1 = const std::basic_string<char>; _T2 = mongocxx::v_noabi::client]’
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7/utility:70:0,
from /usr/include/c++/7/tuple:38,
from /usr/include/c++/7/mutex:38,
from /home/lstorino/psrplot/src/mongo.h:6,
from /home/lstorino/psrplot/src/mongo.cpp:1:
/usr/include/c++/7/bits/stl_pair.h:292:17: note: ‘std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&) [with _T1 = const std::basic_string<char>; _T2 = mongocxx::v_noabi::client]’ is implicitly deleted because the default definition would be ill-formed:
constexpr pair(const pair&) = default;
^~~~
/usr/include/c++/7/bits/stl_pair.h:292:17: error: use of deleted function ‘mongocxx::v_noabi::client::client(const mongocxx::v_noabi::client&)’
In file included from /home/lstorino/psrplot/src/mongo.h:10:0,
from /home/lstorino/psrplot/src/mongo.cpp:1:
/home/lstorino/psrplot/lib/mongo-cxx-driver/src/mongocxx/client.hpp:58:20: note: ‘mongocxx::v_noabi::client::client(const mongocxx::v_noabi::client&)’ is implicitly declared as deleted because ‘mongocxx::v_noabi::client’ declares a move constructor or move assignment operator
class MONGOCXX_API client {
^~~~~~
I need to compile it on this specific envirioment. What could possibly cause this error?