comsee-research / libpleno

An open-source C++ computer-vision library for plenoptic cameras modeling and processing.
GNU General Public License v3.0
13 stars 2 forks source link

installation error #1

Closed renatojmsdh closed 2 years ago

renatojmsdh commented 2 years ago

Hello @MathLabu, nice work! I'm trying to install the library but I'm having one issue: static assertion failed: std::map must have the same value_type as its allocator. After installing the dependencies and during the compilation of libpleno in ubuntu 20.04 and gcc-10. Would you have a clue and help solving this? Thanks!

[  1%] Building CXX object CMakeFiles/pleno.dir/pleno/processing/calibration/mia.cpp.o
In file included from /usr/include/c++/10/map:61,
                 from /usr/local/include/opencv2/flann/params.h:36,
                 from /usr/local/include/opencv2/flann/flann_base.hpp:40,
                 from /usr/local/include/opencv2/flann.hpp:48,
                 from /usr/local/include/opencv2/opencv.hpp:62,
                 from /code/libpleno/pleno/types.h:5,
                 from /code/libpleno/pleno/processing/calibration/calibration.h:3,
                 from /code/libpleno/pleno/processing/calibration/mia.cpp:1:
/usr/include/c++/10/bits/stl_map.h: In instantiation of 'class std::map<MicroImagesArray*, ttt::Indice<MicroImagesArray*>, std::less<MicroImagesArray*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<MicroImagesArray*> > > >':
/usr/include/boost/mpl/aux_/has_type.hpp:20:1:   required by substitution of 'template<class U> static char (& boost::mpl::aux::has_type<std::map<MicroImagesArray*, ttt::Indice<MicroImagesArray*>, std::less<MicroImagesArray*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<MicroImagesArray*> > > >, mpl_::bool_<true> >::gcc_3_2_wknd::test<U>(const volatile boost::mpl::aux::type_wrapper<T>*, boost::mpl::aux::type_wrapper<typename U::type>*))[2] [with U = std::map<MicroImagesArray*, ttt::Indice<MicroImagesArray*>, std::less<MicroImagesArray*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<MicroImagesArray*> > > >]'
/usr/include/boost/mpl/aux_/has_type.hpp:20:1:   required from 'const bool boost::mpl::aux::has_type<std::map<MicroImagesArray*, ttt::Indice<MicroImagesArray*>, std::less<MicroImagesArray*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<MicroImagesArray*> > > >, mpl_::bool_<true> >::value'
/usr/include/boost/mpl/aux_/has_type.hpp:20:1:   required from 'struct boost::mpl::aux::has_type<std::map<MicroImagesArray*, ttt::Indice<MicroImagesArray*>, std::less<MicroImagesArray*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<MicroImagesArray*> > > >, mpl_::bool_<true> >'
/usr/include/boost/mpl/aux_/preprocessed/gcc/quote.hpp:86:12:   required from 'struct boost::mpl::quote4<std::map, mpl_::void_>::apply<MicroImagesArray*, ttt::Indice<MicroImagesArray*>, std::less<MicroImagesArray*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<MicroImagesArray*> > > >'
/usr/include/boost/mpl/aux_/preprocessed/gcc/apply_wrap.hpp:66:8:   required from 'struct boost::mpl::apply_wrap4<boost::mpl::quote4<std::map, mpl_::void_>, MicroImagesArray*, ttt::Indice<MicroImagesArray*>, std::less<MicroImagesArray*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<MicroImagesArray*> > > >'
/usr/include/boost/mpl/aux_/preprocessed/gcc/bind.hpp:349:21:   [ skipping 15 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/boost/mpl/eval_if.hpp:38:31:   required from 'struct boost::mpl::eval_if<boost::mpl::or_<boost::mpl::is_na<mpl_::na>, boost::mpl::is_lambda_expression<boost::fusion::pair<mpl_::arg<1>, std::map<mpl_::arg<1>, ttt::Indice<mpl_::arg<1> > > > >, boost::mpl::not_<boost::mpl::is_sequence<boost::fusion::pair<mpl_::arg<1>, std::map<mpl_::arg<1>, ttt::Indice<mpl_::arg<1> > > > > >, mpl_::bool_<false>, mpl_::bool_<false> >, boost::mpl::transform1<boost::mpl::v_item<Pose_<2>*, boost::mpl::v_item<MicroImagesArray*, boost::mpl::vector0<mpl_::na>, 0>, 0>, boost::fusion::pair<mpl_::arg<1>, std::map<mpl_::arg<1>, ttt::Indice<mpl_::arg<1> > > >, mpl_::na>, boost::mpl::transform2<boost::mpl::v_item<Pose_<2>*, boost::mpl::v_item<MicroImagesArray*, boost::mpl::vector0<mpl_::na>, 0>, 0>, boost::fusion::pair<mpl_::arg<1>, std::map<mpl_::arg<1>, ttt::Indice<mpl_::arg<1> > > >, mpl_::na, mpl_::na> >'
/usr/include/boost/mpl/transform.hpp:138:1:   required from 'struct boost::mpl::transform<boost::mpl::v_item<Pose_<2>*, boost::mpl::v_item<MicroImagesArray*, boost::mpl::vector0<mpl_::na>, 0>, 0>, boost::fusion::pair<mpl_::arg<1>, std::map<mpl_::arg<1>, ttt::Indice<mpl_::arg<1> > > >, mpl_::na, mpl_::na>'
/usr/local/include/libv/lma/lm/bundle/bundle10.hpp:495:41:   required from 'void lma::Bundle<FL, ParamFonctor_>::update() [with FL = boost::mpl::vector<GridReconstructionError>; ParamFonctor_ = lma::AddPointerToListParam<mpl_::arg<1> >]'
/usr/local/include/libv/lma/lm/algo/levmar.hpp:146:21:   required from 'void lma::LevMar<Policy>::init(lma::LevMar<Policy>::Bundle&) [with Policy = lma::Global<lma::View<boost::mpl::vector<GridReconstructionError> >, lma::LDLT, boost::fusion::pair<lma::Eig, double> >; lma::LevMar<Policy>::Bundle = lma::View<boost::mpl::vector<GridReconstructionError> >]'
/usr/local/include/libv/lma/lm/solver/solver2.hpp:78:16:   required from 'lma::Solver<Functors>& lma::Solver<Functors>::solve(const AlgoTag&, F) [with AlgoTag = lma::LdltTag<>; F = lma::enable_verbose_output; Functors = {GridReconstructionError}]'
/code/libpleno/pleno/processing/calibration/mia.cpp:38:58:   required from here
/usr/include/c++/10/bits/stl_map.h:123:71: error: static assertion failed: std::map must have the same value_type as its allocator
  123 |       static_assert(is_same<typename _Alloc::value_type, value_type>::value,
      |                                                                       ^~~~~
/usr/include/c++/10/bits/stl_map.h: In instantiation of 'class std::map<Pose_<2>*, ttt::Indice<Pose_<2>*>, std::less<Pose_<2>*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<Pose_<2>*> > > >':
/usr/include/boost/mpl/aux_/has_type.hpp:20:1:   required by substitution of 'template<class U> static char (& boost::mpl::aux::has_type<std::map<Pose_<2>*, ttt::Indice<Pose_<2>*>, std::less<Pose_<2>*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<Pose_<2>*> > > >, mpl_::bool_<true> >::gcc_3_2_wknd::test<U>(const volatile boost::mpl::aux::type_wrapper<T>*, boost::mpl::aux::type_wrapper<typename U::type>*))[2] [with U = std::map<Pose_<2>*, ttt::Indice<Pose_<2>*>, std::less<Pose_<2>*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<Pose_<2>*> > > >]'
/usr/include/boost/mpl/aux_/has_type.hpp:20:1:   required from 'const bool boost::mpl::aux::has_type<std::map<Pose_<2>*, ttt::Indice<Pose_<2>*>, std::less<Pose_<2>*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<Pose_<2>*> > > >, mpl_::bool_<true> >::value'
/usr/include/boost/mpl/aux_/has_type.hpp:20:1:   required from 'struct boost::mpl::aux::has_type<std::map<Pose_<2>*, ttt::Indice<Pose_<2>*>, std::less<Pose_<2>*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<Pose_<2>*> > > >, mpl_::bool_<true> >'
/usr/include/boost/mpl/aux_/preprocessed/gcc/quote.hpp:86:12:   required from 'struct boost::mpl::quote4<std::map, mpl_::void_>::apply<Pose_<2>*, ttt::Indice<Pose_<2>*>, std::less<Pose_<2>*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<Pose_<2>*> > > >'
/usr/include/boost/mpl/aux_/preprocessed/gcc/apply_wrap.hpp:66:8:   required from 'struct boost::mpl::apply_wrap4<boost::mpl::quote4<std::map, mpl_::void_>, Pose_<2>*, ttt::Indice<Pose_<2>*>, std::less<Pose_<2>*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<Pose_<2>*> > > >'
/usr/include/boost/mpl/aux_/preprocessed/gcc/bind.hpp:349:21:   [ skipping 15 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/boost/mpl/eval_if.hpp:38:31:   required from 'struct boost::mpl::eval_if<boost::mpl::or_<boost::mpl::is_na<mpl_::na>, boost::mpl::is_lambda_expression<boost::fusion::pair<mpl_::arg<1>, std::map<mpl_::arg<1>, ttt::Indice<mpl_::arg<1> > > > >, boost::mpl::not_<boost::mpl::is_sequence<boost::fusion::pair<mpl_::arg<1>, std::map<mpl_::arg<1>, ttt::Indice<mpl_::arg<1> > > > > >, mpl_::bool_<false>, mpl_::bool_<false> >, boost::mpl::transform1<boost::mpl::v_item<Pose_<2>*, boost::mpl::v_item<MicroImagesArray*, boost::mpl::vector0<mpl_::na>, 0>, 0>, boost::fusion::pair<mpl_::arg<1>, std::map<mpl_::arg<1>, ttt::Indice<mpl_::arg<1> > > >, mpl_::na>, boost::mpl::transform2<boost::mpl::v_item<Pose_<2>*, boost::mpl::v_item<MicroImagesArray*, boost::mpl::vector0<mpl_::na>, 0>, 0>, boost::fusion::pair<mpl_::arg<1>, std::map<mpl_::arg<1>, ttt::Indice<mpl_::arg<1> > > >, mpl_::na, mpl_::na> >'
/usr/include/boost/mpl/transform.hpp:138:1:   required from 'struct boost::mpl::transform<boost::mpl::v_item<Pose_<2>*, boost::mpl::v_item<MicroImagesArray*, boost::mpl::vector0<mpl_::na>, 0>, 0>, boost::fusion::pair<mpl_::arg<1>, std::map<mpl_::arg<1>, ttt::Indice<mpl_::arg<1> > > >, mpl_::na, mpl_::na>'
/usr/local/include/libv/lma/lm/bundle/bundle10.hpp:495:41:   required from 'void lma::Bundle<FL, ParamFonctor_>::update() [with FL = boost::mpl::vector<GridReconstructionError>; ParamFonctor_ = lma::AddPointerToListParam<mpl_::arg<1> >]'
/usr/local/include/libv/lma/lm/algo/levmar.hpp:146:21:   required from 'void lma::LevMar<Policy>::init(lma::LevMar<Policy>::Bundle&) [with Policy = lma::Global<lma::View<boost::mpl::vector<GridReconstructionError> >, lma::LDLT, boost::fusion::pair<lma::Eig, double> >; lma::LevMar<Policy>::Bundle = lma::View<boost::mpl::vector<GridReconstructionError> >]'
/usr/local/include/libv/lma/lm/solver/solver2.hpp:78:16:   required from 'lma::Solver<Functors>& lma::Solver<Functors>::solve(const AlgoTag&, F) [with AlgoTag = lma::LdltTag<>; F = lma::enable_verbose_output; Functors = {GridReconstructionError}]'
/code/libpleno/pleno/processing/calibration/mia.cpp:38:58:   required from here
/usr/include/c++/10/bits/stl_map.h:123:71: error: static assertion failed: std::map must have the same value_type as its allocator
make[2]: *** [CMakeFiles/pleno.dir/build.make:817: CMakeFiles/pleno.dir/pleno/processing/calibration/mia.cpp.o] Error 1
MathLabu commented 2 years ago

Hi @renatojmsdh ! Thanks!

Regarding your issue I think the problem does not come from the libpleno but from the lma lib. I guess lma have some struggle with newer version of gcc.

I suspect that it misses a const at the right place in the allocator of the typdef of the map type defined in src/libv/lma/lm/bundle/bundle10.hpp at the lines 487 to 495:

typedef typename br::as_map<
    typename mpl::transform<
      ListeParam,
      bf::pair<
        mpl::_1,
        std::map<mpl::_1,ttt::Indice<mpl::_1>>
      >
    >::type
  >::type MapAdressParameters;

I'm looking into this with the devs/maintainers of the lib lma since I'm not able to reproduce this error on my machine.

Could you try this quick change? In the aforementioned file, could you replace the typedef definition by this code:

typedef typename br::as_map<
    typename mpl::transform<
      ListeParam,
        bf::pair<
          mpl::_1,
          std::map<
            mpl::_1,
            ttt::Indice<mpl::_1>,
            std::less<mpl::_1>,
            std::allocator<std::pair<mpl::_1 const, ttt::Indice<mpl::_1>>
         >
        >
      >
    >::type
  >::type MapAdressParameters;

By expliciting the other templates parameters, it may fix the issue but not I'm not certain. Could keep me update if it works? I'll keep looking for a fix in the meantime!


Otherwise if you are in a hurry, you could still downgrade the version of gcc to the 7.5, the code has been tested for this version, even though this solution is not really satisfactory...

renatojmsdh commented 2 years ago

Hello @MathLabu thanks for the nice and prompt reply.

So downgrading to gcc-7.5 worked fine (I don't have problems with the downgrade because all libraries are being installed inside a Singularity container...so no harm to the overall system).

I first tested replacing the typedef const in lma but similar errors in other definitions with gcc-10 appeared. Some of them for info:

/usr/include/c++/10/bits/stl_map.h:123:71: error: static assertion failed: std::map must have the same value_type as its allocator
/usr/include/c++/10/bits/stl_map.h: In instantiation of 'class std::map<Distortions*, ttt::Indice<Distortions*>, std::less<Distortions*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<Distortions*> > > >':

/usr/include/c++/10/bits/stl_map.h:123:71: error: static assertion failed: std::map must have the same value_type as its allocator
/usr/include/c++/10/bits/stl_map.h: In instantiation of 'class std::map<FocalLength*, ttt::Indice<FocalLength*>, std::less<FocalLength*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<FocalLength*> > > >':

/code/libpleno/pleno/processing/calibration/plenoptic.cpp:109:2:   required from here
/usr/include/c++/10/bits/stl_map.h:123:71: error: static assertion failed: std::map must have the same value_type as its allocator
  123 |       static_assert(is_same<typename _Alloc::value_type, value_type>::value,
/usr/include/c++/10/bits/stl_map.h: In instantiation of 'class std::map<GridMesh_<3>*, ttt::Indice<GridMesh_<3>*>, std::less<GridMesh_<3>*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<GridMesh_<3>*> > > >':

/code/libpleno/pleno/processing/calibration/plenoptic.cpp:109:2:   required from here
/usr/include/c++/10/bits/stl_map.h:123:71: error: static assertion failed: std::map must have the same value_type as its allocator
/usr/include/c++/10/bits/stl_map.h: In instantiation of 'class std::map<ThinLensCamera*, ttt::Indice<ThinLensCamera*>, std::less<ThinLensCamera*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<ThinLensCamera*> > > >':

/code/libpleno/pleno/processing/calibration/plenoptic.cpp:109:2:   required from here
/usr/include/c++/10/bits/stl_map.h:123:71: error: static assertion failed: std::map must have the same value_type as its allocator
/usr/include/c++/10/bits/stl_map.h: In instantiation of 'class std::map<Sensor*, ttt::Indice<Sensor*>, std::less<Sensor*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<Sensor*> > > >':

In instantiation of 'class std::map<Pose_<3>*, ttt::Indice<Pose_<3>*>, std::less<Pose_<3>*>, std::allocator<std::pair<const mpl_::arg<1>, ttt::Indice<Pose_<3>*> > > >':

Thanks again for your help and time for solving it! We can now start testing and running it :wink: