roboptim-core icon indicating copy to clipboard operation
roboptim-core copied to clipboard

Problems with "solver.hh" and "problem.hh" while compiling tutorial excercise

Open BenziF opened this issue 4 years ago • 0 comments

I built the entire 3.1 version of the library using Robotpkg, since the Ubuntu version is only the 2.0 one, while .

The library was built, but then i implemented the code presented in the tutorial in a cpp file and tried to build my workspace using catkin_make. For some reason, as soon as i add the lines creating the cost function and the problem I get a series of errors, besides many warnings related to ROBOPTIM_CORE_DEPRECATED. It seems most of these errors are related to the boost library, of which i'm using version 1.58 for Ubuntu 16.04. I paste here the given errors (I don't mind inserting the warnings since they shouldn't be relevant).

In file included from /usr/include/boost/mpl/aux_/na_assert.hpp:23:0, from /usr/include/boost/mpl/arg.hpp:25, from /usr/include/boost/variant/variant_fwd.hpp:19, from /usr/include/boost/variant/detail/variant_io.hpp:18, from /opt/openrobots/include/roboptim/core/io.hh:24, from /opt/openrobots/include/roboptim/core.hh:25, from /home/benzi/benzi_ws/src/redundancy_solver/src/problem_definition.cpp:4: /opt/openrobots/include/roboptim/core/solver.hh: In instantiation of ‘class roboptim::Solver<roboptim::EigenMatrixDense>’: /home/benzi/benzi_ws/src/redundancy_solver/src/problem_definition.cpp:121:11: required from here /opt/openrobots/include/roboptim/core/solver.hh:84:5: error: no matching function for call to ‘assertion_failed(mpl_::failed************ boost::mpl::or_<boost::is_base_of<roboptim::GenericFunction<roboptim::EigenMatrixDense>, roboptim::EigenMatrixDense>, boost::is_base_of<roboptim::GenericFunction<roboptim::EigenMatrixSparse>, roboptim::EigenMatrixDense>, mpl_::bool_<false>, mpl_::bool_<false>, mpl_::bool_<false> >::************)’ BOOST_MPL_ASSERT((boost::mpl::or_<boost::is_base_of<Function, F>, ^ /usr/include/boost/mpl/assert.hpp:83:5: note: candidate: template<bool C> int mpl_::assertion_failed(typename mpl_::assert<C>::type) int assertion_failed( typename assert<C>::type ); ^ /usr/include/boost/mpl/assert.hpp:83:5: note: template argument deduction/substitution failed: /opt/openrobots/include/roboptim/core/solver.hh:84:5: note: cannot convert ‘mpl_::assert_arg<boost::mpl::or_<boost::is_base_of<roboptim::GenericFunction<roboptim::EigenMatrixDense>, roboptim::EigenMatrixDense>, boost::is_base_of<roboptim::GenericFunction<roboptim::EigenMatrixSparse>, roboptim::EigenMatrixDense>, mpl_::bool_<false>, mpl_::bool_<false>, mpl_::bool_<false> > >(0u, 1)’ (type ‘mpl_::failed************ boost::mpl::or_<boost::is_base_of<roboptim::GenericFunction<roboptim::EigenMatrixDense>, roboptim::EigenMatrixDense>, boost::is_base_of<roboptim::GenericFunction<roboptim::EigenMatrixSparse>, roboptim::EigenMatrixDense>, mpl_::bool_<false>, mpl_::bool_<false>, mpl_::bool_<false> >::************’) to type ‘mpl_::assert<false>::type {aka mpl_::assert<false>}’ BOOST_MPL_ASSERT((boost::mpl::or_<boost::is_base_of<Function, F>, ^ In file included from /opt/openrobots/include/roboptim/core/solver-factory.hh:32:0, from /opt/openrobots/include/roboptim/core.hh:47, from /home/benzi/benzi_ws/src/redundancy_solver/src/problem_definition.cpp:4: /opt/openrobots/include/roboptim/core/solver.hh:95:34: error: no type named ‘vector_t’ in ‘struct roboptim::EigenMatrixDense’ typedef typename F::vector_t vector_t; ^ In file included from /usr/include/boost/mpl/aux_/na_assert.hpp:23:0, from /usr/include/boost/mpl/arg.hpp:25, from /usr/include/boost/variant/variant_fwd.hpp:19, from /usr/include/boost/variant/detail/variant_io.hpp:18, from /opt/openrobots/include/roboptim/core/io.hh:24, from /opt/openrobots/include/roboptim/core.hh:25, from /home/benzi/benzi_ws/src/redundancy_solver/src/problem_definition.cpp:4: /opt/openrobots/include/roboptim/core/problem.hh: In instantiation of ‘class roboptim::Problem<roboptim::EigenMatrixDense, roboptim::EigenMatrixDense>’: /opt/openrobots/include/roboptim/core/solver.hh:184:21: required from ‘class roboptim::Solver<roboptim::EigenMatrixDense>’ /home/benzi/benzi_ws/src/redundancy_solver/src/problem_definition.cpp:121:11: required from here /opt/openrobots/include/roboptim/core/problem.hh:263:5: error: no matching function for call to ‘assertion_failed(mpl_::failed************ (roboptim::Problem<roboptim::EigenMatrixDense, roboptim::EigenMatrixDense>::ROBOPTIM_FUNCTION_EXPECTED_FOR_COST::************)(roboptim::EigenMatrixDense&))’ BOOST_MPL_ASSERT_MSG((detail::derives_from_function<F>::type::value), ^ /usr/include/boost/mpl/assert.hpp:83:5: note: candidate: template<bool C> int mpl_::assertion_failed(typename mpl_::assert<C>::type) int assertion_failed( typename assert<C>::type ); ^ /usr/include/boost/mpl/assert.hpp:83:5: note: template argument deduction/substitution failed: /opt/openrobots/include/roboptim/core/problem.hh:263:5: note: cannot convert ‘roboptim::Problem<F, C>::ROBOPTIM_FUNCTION_EXPECTED_FOR_COST264::assert_arg<roboptim::EigenMatrixDense, roboptim::EigenMatrixDense>()’ (type ‘mpl_::failed************ (roboptim::Problem<roboptim::EigenMatrixDense, roboptim::EigenMatrixDense>::ROBOPTIM_FUNCTION_EXPECTED_FOR_COST::************)(roboptim::EigenMatrixDense&)’) to type ‘mpl_::assert<false>::type {aka mpl_::assert<false>}’ BOOST_MPL_ASSERT_MSG((detail::derives_from_function<F>::type::value), ^ In file included from /opt/openrobots/include/roboptim/core/generic-solver.hh:36:0, from /opt/openrobots/include/roboptim/core.hh:34, from /home/benzi/benzi_ws/src/redundancy_solver/src/problem_definition.cpp:4: /opt/openrobots/include/roboptim/core/problem.hh:295:45: error: no type named ‘value_type’ in ‘roboptim::Problem<roboptim::EigenMatrixDense, roboptim::EigenMatrixDense>::function_t {aka struct roboptim::EigenMatrixDense}’ typedef typename function_t::value_type value_type; ^ /opt/openrobots/include/roboptim/core/problem.hh:298:43: error: no type named ‘vector_t’ in ‘roboptim::Problem<roboptim::EigenMatrixDense, roboptim::EigenMatrixDense>::function_t {aka struct roboptim::EigenMatrixDense}’ typedef typename function_t::vector_t vector_t; ^ /opt/openrobots/include/roboptim/core/problem.hh:301:45: error: no type named ‘argument_t’ in ‘roboptim::Problem<roboptim::EigenMatrixDense, roboptim::EigenMatrixDense>::function_t {aka struct roboptim::EigenMatrixDense}’ typedef typename function_t::argument_t argument_t; ^ /opt/openrobots/include/roboptim/core/problem.hh:304:44: error: no type named ‘size_type’ in ‘roboptim::Problem<roboptim::EigenMatrixDense, roboptim::EigenMatrixDense>::function_t {aka struct roboptim::EigenMatrixDense}’ typedef typename function_t::size_type size_type; ^ /opt/openrobots/include/roboptim/core/problem.hh:310:41: error: no type named ‘argument_t’ in ‘struct roboptim::EigenMatrixDense’ typedef boost::optional<argument_t> startingPoint_t; ^ /opt/openrobots/include/roboptim/core/problem.hh:313:45: error: no type named ‘interval_t’ in ‘roboptim::Problem<roboptim::EigenMatrixDense, roboptim::EigenMatrixDense>::function_t {aka struct roboptim::EigenMatrixDense}’ typedef typename function_t::interval_t interval_t; ^ /opt/openrobots/include/roboptim/core/problem.hh:316:46: error: no type named ‘intervals_t’ in ‘roboptim::Problem<roboptim::EigenMatrixDense, roboptim::EigenMatrixDense>::function_t {aka struct roboptim::EigenMatrixDense}’ typedef typename function_t::intervals_t intervals_t; ^ /opt/openrobots/include/roboptim/core/problem.hh:319:37: error: no type named ‘value_type’ in ‘struct roboptim::EigenMatrixDense’ typedef std::vector<value_type> scaling_t; ^ /opt/openrobots/include/roboptim/core/problem.hh:325:42: error: no type named ‘names_t’ in ‘roboptim::Problem<roboptim::EigenMatrixDense, roboptim::EigenMatrixDense>::function_t {aka struct roboptim::EigenMatrixDense}’ typedef typename function_t::names_t names_t; ^ /opt/openrobots/include/roboptim/core/problem.hh:333:38: error: no type named ‘intervals_t’ in ‘struct roboptim::EigenMatrixDense’ typedef std::vector<intervals_t> intervalsVect_t; ^ /opt/openrobots/include/roboptim/core/problem.hh:341:36: error: no type named ‘value_type’ in ‘struct roboptim::EigenMatrixDense’ typedef std::vector<scaling_t> scalingVect_t; ^ /home/benzi/benzi_ws/src/redundancy_solver/src/problem_definition.cpp: In function ‘int run_test()’: /home/benzi/benzi_ws/src/redundancy_solver/src/problem_definition.cpp:121:28: error: no matching function for call to ‘roboptim::Problem<roboptim::EigenMatrixDense, roboptim::EigenMatrixDense>::Problem(boost::shared_ptr<F>&)’ solver_t::problem_t pb (f); ^ In file included from /opt/openrobots/include/roboptim/core/generic-solver.hh:36:0, from /opt/openrobots/include/roboptim/core.hh:34, from /home/benzi/benzi_ws/src/redundancy_solver/src/problem_definition.cpp:4: /opt/openrobots/include/roboptim/core/problem.hh:360:14: note: candidate: template<class F_, class CLIST_> roboptim::Problem<F, C>::Problem(const roboptim::Problem<F_, CLIST_>&) explicit Problem (const Problem<F_, CLIST_>& pb); ^ /opt/openrobots/include/roboptim/core/problem.hh:360:14: note: template argument deduction/substitution failed: /home/benzi/benzi_ws/src/redundancy_solver/src/problem_definition.cpp:121:28: note: ‘boost::shared_ptr<F>’ is not derived from ‘const roboptim::Problem<F, CLIST>’ solver_t::problem_t pb (f); ^ In file included from /opt/openrobots/include/roboptim/core/problem.hh:541:0, from /opt/openrobots/include/roboptim/core/generic-solver.hh:36, from /opt/openrobots/include/roboptim/core.hh:34, from /home/benzi/benzi_ws/src/redundancy_solver/src/problem_definition.cpp:4: /opt/openrobots/include/roboptim/core/problem.hxx:260:3: note: candidate: roboptim::Problem<F, C>::Problem(const roboptim::Problem<F, C>&) [with F = roboptim::EigenMatrixDense; CLIST = roboptim::EigenMatrixDense] Problem<F, CLIST>::Problem (const Problem<F, CLIST>& pb) ^ /opt/openrobots/include/roboptim/core/problem.hxx:260:3: note: no known conversion for argument 1 from ‘boost::shared_ptr<F>’ to ‘const roboptim::Problem<roboptim::EigenMatrixDense, roboptim::EigenMatrixDense>&’ /opt/openrobots/include/roboptim/core/problem.hxx:236:3: note: candidate: roboptim::Problem<F, C>::Problem(const function_t&) [with F = roboptim::EigenMatrixDense; CLIST = roboptim::EigenMatrixDense; roboptim::Problem<F, C>::function_t = roboptim::EigenMatrixDense] Problem<F, CLIST>::Problem (const function_t& f) ^ /opt/openrobots/include/roboptim/core/problem.hxx:236:3: note: no known conversion for argument 1 from ‘boost::shared_ptr<F>’ to ‘const function_t& {aka const roboptim::EigenMatrixDense&}’ In file included from /usr/include/boost/tuple/tuple.hpp:24:0, from /usr/include/boost/tuple/tuple_io.hpp:21, from /opt/openrobots/include/roboptim/core/io.hh:23, from /opt/openrobots/include/roboptim/core.hh:25, from /home/benzi/benzi_ws/src/redundancy_solver/src/problem_definition.cpp:4: /usr/include/boost/variant/variant.hpp: In instantiation of ‘class boost::variant<boost::detail::variant::over_sequence<boost::mpl::vector0<mpl_::na> > >’: /usr/include/c++/5/bits/stl_vector.h:161:9: required from ‘std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = boost::variant<boost::detail::variant::over_sequence<boost::mpl::vector0<mpl_::na> > >; _Alloc = std::allocator<boost::variant<boost::detail::variant::over_sequence<boost::mpl::vector0<mpl_::na> > > >]’ /usr/include/c++/5/bits/stl_vector.h:425:33: required from ‘std::vector<_Tp, _Alloc>::~vector() [with _Tp = boost::variant<boost::detail::variant::over_sequence<boost::mpl::vector0<mpl_::na> > >; _Alloc = std::allocator<boost::variant<boost::detail::variant::over_sequence<boost::mpl::vector0<mpl_::na> > > >]’ /opt/openrobots/include/roboptim/core/problem.hxx:256:3: required from ‘roboptim::Problem<F, C>::~Problem() [with F = roboptim::EigenMatrixDense; CLIST = roboptim::EigenMatrixDense]’ /home/benzi/benzi_ws/src/redundancy_solver/src/problem_definition.cpp:121:28: required from here /usr/include/boost/variant/variant.hpp:1119:5: error: static assertion failed: ( ::boost::mpl::not_< mpl::empty<specified_types> >::value ) BOOST_STATIC_ASSERT(( ^ redundancy_solver/CMakeFiles/redundancy_solver_node.dir/build.make:110: recipe for target 'redundancy_solver/CMakeFiles/redundancy_solver_node.dir/src/problem_definition.cpp.o' failed make[2]: *** [redundancy_solver/CMakeFiles/redundancy_solver_node.dir/src/problem_definition.cpp.o] Error 1 CMakeFiles/Makefile2:7242: recipe for target 'redundancy_solver/CMakeFiles/redundancy_solver_node.dir/all' failed make[1]: *** [redundancy_solver/CMakeFiles/redundancy_solver_node.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: *** [all] Error 2 Invoking "make -j8 -l8" failed

I really wanted to test the library for my algorithms, is there anything I can do? I know downgrading the boost version is a painful process but I was considering it.

Thank you in advance for your attention

BenziF avatar May 08 '20 10:05 BenziF