AW: [eigen] Eigen 3.3.0 compile error with aligned_allocator

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Ok, and i also tested your minimal example from http://rextester.com/XHGN60496 now, sorry, seems to compile, arg. Must be a problem of pcl then… but don’t really have a clue what is going wrong here…

 

Von: Lodron, Gerald [mailto:Gerald.Lodron@xxxxxxxxxxx]
Gesendet: Donnerstag, 24. November 2016 06:33
An: eigen@xxxxxxxxxxxxxxxxxxx
Betreff: AW: [eigen] Eigen 3.3.0 compile error with aligned_allocator

 

Ok, here my complete error message from PCL:

 

E:\Develop\Libraries120_x64\boost\1.62.0-NoPython\include\boost-1_62\boost/unordered/detail/allocate.hpp(497) : error C2664: 'Eigen::aligned_allocator<U>::aligned_allocator(const Eigen::aligned_allocator<U> &)' : cannot convert argument 1 from 'std::allocator<T>' to 'const Eigen::aligned_allocator<U> &'

        with

        [

            U=boost::unordered::detail::ptr_node<std::pair<const int,pcl::GridProjection<pcl::PointNormal>::Leaf>>

        ]

        and

        [

            T=boost::unordered::detail::ptr_node<std::pair<const int,pcl::GridProjection<pcl::PointNormal>::Leaf>>

        ]

        and

        [

            U=boost::unordered::detail::ptr_node<std::pair<const int,pcl::GridProjection<pcl::PointNormal>::Leaf>>

        ]

        Reason: cannot convert from 'std::allocator<T>' to 'const Eigen::aligned_allocator<U>'

        with

        [

            T=boost::unordered::detail::ptr_node<std::pair<const int,pcl::GridProjection<pcl::PointNormal>::Leaf>>

        ]

        and

        [

            U=boost::unordered::detail::ptr_node<std::pair<const int,pcl::GridProjection<pcl::PointNormal>::Leaf>>

        ]

        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

        E:\Develop\Libraries120_x64\boost\1.62.0-NoPython\include\boost-1_62\boost/unordered/detail/allocate.hpp(704) : see reference to function template instantiation 'Alloc boost::unordered::detail::func::call_select_on_container_copy_construction<Alloc>(const Alloc &,void *)' being compiled

        with

        [

            Alloc=Eigen::aligned_allocator<boost::unordered::detail::ptr_node<std::pair<const int,pcl::GridProjection<pcl::PointNormal>::Leaf>>>

        ]

        E:\Develop\Libraries120_x64\boost\1.62.0-NoPython\include\boost-1_62\boost/unordered/detail/allocate.hpp(702) : while compiling class template member function 'Eigen::aligned_allocator<U> boost::unordered::detail::allocator_traits<Eigen::aligned_allocator<U>>::select_on_container_copy_construction(const Alloc &)'

        with

        [

            U=boost::unordered::detail::ptr_node<std::pair<const int,pcl::GridProjection<pcl::PointNormal>::Leaf>>

,            Alloc=Eigen::aligned_allocator<boost::unordered::detail::ptr_node<std::pair<const int,pcl::GridProjection<pcl::PointNormal>::Leaf>>>

        ]

        E:\Develop\Libraries120_x64\boost\1.62.0-NoPython\include\boost-1_62\boost/unordered/detail/unique.hpp(163) : see reference to function template instantiation 'Eigen::aligned_allocator<U> boost::unordered::detail::allocator_traits<Eigen::aligned_allocator<U>>::select_on_container_copy_construction(const Alloc &)' being compiled

        with

        [

            U=boost::unordered::detail::ptr_node<std::pair<const int,pcl::GridProjection<pcl::PointNormal>::Leaf>>

,            Alloc=Eigen::aligned_allocator<boost::unordered::detail::ptr_node<std::pair<const int,pcl::GridProjection<pcl::PointNormal>::Leaf>>>

        ]

        E:\Develop\Libraries120_x64\boost\1.62.0-NoPython\include\boost-1_62\boost/unordered/detail/unique.hpp(120) : see reference to class template instantiation 'boost::unordered::detail::allocator_traits<Eigen::aligned_allocator<U>>' being compiled

        with

        [

           U=boost::unordered::detail::ptr_node<std::pair<const int,pcl::GridProjection<pcl::PointNormal>::Leaf>>

        ]

        E:\Develop\Libraries120_x64\boost\1.62.0-NoPython\include\boost-1_62\boost/unordered/detail/map.hpp(25) : see reference to class template instantiation 'boost::unordered::detail::pick_node<Eigen::aligned_allocator<int>,std::pair<const K,T>>' being compiled

        with

        [

            K=int

,            T=pcl::GridProjection<pcl::PointNormal>::Leaf

        ]

        E:\Develop\Libraries120_x64\boost\1.62.0-NoPython\include\boost-1_62\boost/unordered/unordered_map.hpp(58) : see reference to class template instantiation 'boost::unordered::detail::map<A,K,T,H,P>' being compiled

        with

        [

            A=Eigen::aligned_allocator<int>

,            K=int

,            T=pcl::GridProjection<pcl::PointNormal>::Leaf

,            H=boost::hash<int>

,            P=std::equal_to<int>

        ]

        E:\Develop\Source\pcl-1.8.2\surface\include\pcl/surface/grid_projection.h(462) : see reference to class template instantiation 'boost::unordered::unordered_map<int,pcl::GridProjection<pcl::PointNormal>::Leaf,boost::hash<int>,std::equal_to<int>,Eigen::aligned_allocator<int>>' being compiled

        E:\Develop\Source\pcl-1.8.2\surface\src\grid_projection.cpp(44) : see reference to class template instantiation 'pcl::GridProjection<pcl::PointNormal>' being compiled

 

 

Von: Lodron, Gerald
Gesendet: Mittwoch, 23. November 2016 14:17
An: eigen
Betreff: AW: [eigen] Eigen 3.3.0 compile error with aligned_allocator

 

No problem, not urgent for me, i can live with eigen 3.2.8 currently. I only wanted to report it since it seems for me to be a problem in eigen, (but truly I am not sure):

 

My exact workflow was building trunk (1 week old or so) of the PCL (point cloud library) with latest boost 1.62.0 and latest Eigen 3.3.0 (and also tested all versions above 3.2.8) with visual studio professional 2013 x64 (with some other 3rd parties but should not be related to that). Then I got the below compiler error in the pcl/surface package in the grid_projection.h on instantiation of typedef boost::unordered_map<int, Leaf, boost::hash<int>, std::equal_to<int>, Eigen::aligned_allocator<int> > HashMap;.

 

If you give me some time (currently I am external and not in office, maybe next 3 days) I could recompile your minimal example with eigen 3.3 and test it on your minimal example…. But I also downloaded the official PCL binary installer package and inside that I found all latest 3rd party librearies expect those from Eigen which is an older one (so there seems to be also a problem for the builder of that official PCL package with the newest version, or it is an extreme random chance/huge coincidence that they forgot to update it)

 

Best regards,

Gerald

 

Von: Gael Guennebaud [mailto:gael.guennebaud@xxxxxxxxx]
Gesendet: Mittwoch, 23. November 2016 13:51
An: eigen
Betreff: Re: [eigen] Eigen 3.3.0 compile error with aligned_allocator

 

 

Hi,

 

sorry for late reply, but I cannot reproduce. I tried clang, gcc, and MSVC 19.00 (boost 1.59 and 1.60).

 

See this self-contained example:

 

BTW, I don't see how the reported error is related to operator==. Moreover, I think that the error message is incomplete, please paste the complete error message so that we can see what the template instantiations that led to this error.

 

gael

 

 

On Wed, Nov 16, 2016 at 8:38 AM, Lodron, Gerald <Gerald.Lodron@xxxxxxxxxxx> wrote:

Hi

I am compiling PCL trunk with Eigen3.3.0 (and VS2013x64, boost 1.62.0) and get a compilation error on the intantiation of

typedef boost::unordered_map<int, Leaf, boost::hash<int>, std::equal_to<int>, Eigen::aligned_allocator<int> > HashMap;

HashMap cell_hash_map_;


E:\Develop\Libraries120_x64\boost\1.62.0-NoPython\include\boost-1_62\boost/unordered/detail/allocate.hpp(497) : error C2664: 'Eigen::aligned_allocator<U>::aligned_allocator(const Eigen::aligned_allocator<U> &)' : cannot convert argument 1 from 'std::allocator<T>' to 'const Eigen::aligned_allocator<U> &'
        with
        [
            U=boost::unordered::detail::ptr_node<std::pair<const int,pcl::GridProjection<pcl::PointNormal>::Leaf>>
        ]
        and
        [
            T=boost::unordered::detail::ptr_node<std::pair<const int,pcl::GridProjection<pcl::PointNormal>::Leaf>>
        ]
        and
        [
            U=boost::unordered::detail::ptr_node<std::pair<const int,pcl::GridProjection<pcl::PointNormal>::Leaf>>
        ]
        Reason: cannot convert from 'std::allocator<T>' to 'const Eigen::aligned_allocator<U>'


I googled a little bit and found
http://stackoverflow.com/questions/16126133/compiling-issue-with-custom-allocators-when-std-c0x-is-enabled

“The error message actually contains the hint. I’ve reformulated it slightly here:
error: invalid operands [of type aligned_allocator<int>] to binary _expression_ […] __x._M_get_Tp_allocator() == this->_M_get_Tp_allocator()
In other words, your allocator type needs to provide an operator ==.
This is part of the allocator requirements (§17.6.3.5, table 28). This has always been the case. But until C++11 allocators were stateless and operator == consequently always returned true, so the standard library containers probably never called the operator. This would explain why the code compiles without -std=++0x.


Could it be that you need some operator definitions in the aligned_allocator of eigen? The compilation error is only since eigen 3.2.9, on eigen 3.2.8 it works. The difference which causes the error is the inheritance from std::allocator of Eigen::aligned_allocator....

 



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/