opencog / atomspace

The OpenCog (hyper-)graph database and graph rewriting system
https://wiki.opencog.org/w/AtomSpace
Other
813 stars 225 forks source link

build fails on DivideLink.cc.o for ubuntu 14.04 but not 16.04 #1479

Closed mjsduncan closed 6 years ago

mjsduncan commented 6 years ago

is this a gcc version issue?

[ 32%] Building CXX object opencog/atoms/reduct/CMakeFiles/clearbox.dir/DivideLink.cc.o
/home/cog/opencog/atomspace/opencog/atoms/reduct/DivideLink.cc: In member function ‘void opencog::DivideLink::init()’:
/home/cog/opencog/atomspace/opencog/atoms/reduct/DivideLink.cc:65:44: error: no matching function for call to ‘std::vector<opencog::Handle>::insert(std::vector<opencog::Handle>::const_iterator, opencog::Handle&)’
   _outgoing.insert(_outgoing.cbegin(), knil);
                                            ^
/home/cog/opencog/atomspace/opencog/atoms/reduct/DivideLink.cc:65:44: note: candidates are:
In file included from /usr/include/c++/4.8/vector:69:0,
                 from /home/cog/opencog/atomspace/opencog/atoms/base/ClassServer.h:29,
                 from /home/cog/opencog/atomspace/opencog/atoms/reduct/DivideLink.cc:24:
/usr/include/c++/4.8/bits/vector.tcc:107:5: note: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::iterator, const value_type&) [with _Tp = opencog::Handle; _Alloc = std::allocator<opencog::Handle>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<opencog::Handle*, std::vector<opencog::Handle> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = opencog::Handle*; std::vector<_Tp, _Alloc>::value_type = opencog::Handle]
     vector<_Tp, _Alloc>::
     ^
/usr/include/c++/4.8/bits/vector.tcc:107:5: note:   no known conversion for argument 1 from ‘std::vector<opencog::Handle>::const_iterator {aka __gnu_cxx::__normal_iterator<const opencog::Handle*, std::vector<opencog::Handle> >}’ to ‘std::vector<opencog::Handle>::iterator {aka __gnu_cxx::__normal_iterator<opencog::Handle*, std::vector<opencog::Handle> >}’
In file included from /usr/include/c++/4.8/vector:64:0,
                 from /home/cog/opencog/atomspace/opencog/atoms/base/ClassServer.h:29,
                 from /home/cog/opencog/atomspace/opencog/atoms/reduct/DivideLink.cc:24:
/usr/include/c++/4.8/bits/stl_vector.h:988:7: note: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::iterator, std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = opencog::Handle; _Alloc = std::allocator<opencog::Handle>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<opencog::Handle*, std::vector<opencog::Handle> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = opencog::Handle*; std::vector<_Tp, _Alloc>::value_type = opencog::Handle]
       insert(iterator __position, value_type&& __x)
       ^
/usr/include/c++/4.8/bits/stl_vector.h:988:7: note:   no known conversion for argument 1 from ‘std::vector<opencog::Handle>::const_iterator {aka __gnu_cxx::__normal_iterator<const opencog::Handle*, std::vector<opencog::Handle> >}’ to ‘std::vector<opencog::Handle>::iterator {aka __gnu_cxx::__normal_iterator<opencog::Handle*, std::vector<opencog::Handle> >}’
/usr/include/c++/4.8/bits/stl_vector.h:1005:7: note: void std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::iterator, std::initializer_list<_Tp>) [with _Tp = opencog::Handle; _Alloc = std::allocator<opencog::Handle>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<opencog::Handle*, std::vector<opencog::Handle> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = opencog::Handle*]
       insert(iterator __position, initializer_list<value_type> __l)
       ^
/usr/include/c++/4.8/bits/stl_vector.h:1005:7: note:   no known conversion for argument 1 from ‘std::vector<opencog::Handle>::const_iterator {aka __gnu_cxx::__normal_iterator<const opencog::Handle*, std::vector<opencog::Handle> >}’ to ‘std::vector<opencog::Handle>::iterator {aka __gnu_cxx::__normal_iterator<opencog::Handle*, std::vector<opencog::Handle> >}’
/usr/include/c++/4.8/bits/stl_vector.h:1023:7: note: void std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::iterator, std::vector<_Tp, _Alloc>::size_type, const value_type&) [with _Tp = opencog::Handle; _Alloc = std::allocator<opencog::Handle>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<opencog::Handle*, std::vector<opencog::Handle> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = opencog::Handle*; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = opencog::Handle]
       insert(iterator __position, size_type __n, const value_type& __x)
       ^
/usr/include/c++/4.8/bits/stl_vector.h:1023:7: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/4.8/bits/stl_vector.h:1044:9: note: template<class _InputIterator, class> void std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::iterator, _InputIterator, _InputIterator) [with _InputIterator = _InputIterator; <template-parameter-2-2> = <template-parameter-1-2>; _Tp = opencog::Handle; _Alloc = std::allocator<opencog::Handle>]
         insert(iterator __position, _InputIterator __first,
         ^
/usr/include/c++/4.8/bits/stl_vector.h:1044:9: note:   template argument deduction/substitution failed:
/home/cog/opencog/atomspace/opencog/atoms/reduct/DivideLink.cc:65:44: note:   cannot convert ‘((opencog::DivideLink*)this)->opencog::DivideLink::<anonymous>.opencog::ArithmeticLink::<anonymous>.opencog::FoldLink::<anonymous>.opencog::FunctionLink::<anonymous>.opencog::FreeLink::<anonymous>.opencog::Link::_outgoing.std::vector<_Tp, _Alloc>::cbegin<opencog::Handle, std::allocator<opencog::Handle> >()’ (type ‘std::vector<opencog::Handle>::const_iterator {aka __gnu_cxx::__normal_iterator<const opencog::Handle*, std::vector<opencog::Handle> >}’) to type ‘std::vector<opencog::Handle>::iterator {aka __gnu_cxx::__normal_iterator<opencog::Handle*, std::vector<opencog::Handle> >}’
   _outgoing.insert(_outgoing.cbegin(), knil);
                                            ^
make[2]: *** [opencog/atoms/reduct/CMakeFiles/clearbox.dir/DivideLink.cc.o] Error 1
make[1]: *** [opencog/atoms/reduct/CMakeFiles/clearbox.dir/all] Error 2
make: *** [all] Error 2
linas commented 6 years ago

try changing cbegin() to begin() that should fix it.

linas commented 6 years ago

Its a standard library issue. The documentation says that both forms have been available since c++11 but apparently 14.04 overlooked the const forms.

linas commented 6 years ago

I just pushed a fix for this.

mjsduncan commented 6 years ago

thx!