Eigenでエラーが出てコンパイルできないときは

Ubuntu14.04でChoreonoid 1.6を使っているが、何かの拍子に、突然コンパイルが通らなくなって面食らった。
以下、長いうえに意味がさっぱりわからないエラーメッセージである。

/usr/local/include/eigen3/Eigen/src/Core/util/Memory.h: In instantiation of ‘void Eigen::aligned_allocator<T>::construct(Eigen::aligned_allocator<T>::pointer, const T&) [with T = std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u>; Eigen::aligned_allocator<T>::pointer = std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u>*]’:
/usr/include/c++/4.8/bits/alloc_traits.h:254:4:   required from ‘static typename std::enable_if<std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::value, void>::type std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u>; _Args = {const Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>}; _Alloc = Eigen::aligned_allocator<std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u> >; typename std::enable_if<std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::value, void>::type = void]’
/usr/include/c++/4.8/bits/alloc_traits.h:393:57:   required from ‘static decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) std::allocator_traits<_Alloc>::construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u>; _Args = {const Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>}; _Alloc = Eigen::aligned_allocator<std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u> >; decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) = <type error>]’
/usr/include/c++/4.8/bits/shared_ptr_base.h:503:37:   required from ‘std::__shared_count<_Lp>::__shared_count(std::_Sp_make_shared_tag, _Tp*, const _Alloc&, _Args&& ...) [with _Tp = {anonymous}::TransparentShapeInfo; _Alloc = Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>; _Args = {}; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’
/usr/include/c++/4.8/bits/shared_ptr_base.h:957:35:   required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_make_shared_tag, const _Alloc&, _Args&& ...) [with _Alloc = Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>; _Args = {}; _Tp = {anonymous}::TransparentShapeInfo; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’
/usr/include/c++/4.8/bits/shared_ptr.h:316:64:   required from ‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_make_shared_tag, const _Alloc&, _Args&& ...) [with _Alloc = Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>; _Args = {}; _Tp = {anonymous}::TransparentShapeInfo]’
/usr/include/c++/4.8/bits/shared_ptr.h:598:39:   required from ‘std::shared_ptr<_Tp1> std::allocate_shared(const _Alloc&, _Args&& ...) [with _Tp = {anonymous}::TransparentShapeInfo; _Alloc = Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>; _Args = {}]’
/home/*****/workspace/choreonoid-1.6/src/Util/EigenUtil.h:80:92:   required from ‘std::shared_ptr<_Tp1> cnoid::make_shared_aligned(Args&& ...) [with T = {anonymous}::TransparentShapeInfo; Args = {}]’
/home/*****/workspace/choreonoid-1.6/src/Base/GL1SceneRenderer.cpp:1005:98:   required from here
/usr/local/include/eigen3/Eigen/src/Core/util/Memory.h:733:9: error: use of deleted function ‘std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u>::_Sp_counted_ptr_inplace(const std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u>&)’
         ::new( p ) T( value );
         ^
In file included from /usr/include/c++/4.8/bits/shared_ptr.h:52:0,
                 from /usr/include/c++/4.8/memory:82,
                 from /home/*****/workspace/choreonoid-1.6/src/Util/SceneDrawables.h:12,
                 from /home/*****/workspace/choreonoid-1.6/include/cnoid/SceneDrawables:1,
                 from /home/*****/workspace/choreonoid-1.6/src/Base/GL1SceneRenderer.cpp:7:
/usr/include/c++/4.8/bits/shared_ptr_base.h:379:11: note: ‘std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u>::_Sp_counted_ptr_inplace(const std::_Sp_counted_ptr_inplace<{anonymous}::TransparentShapeInfo, Eigen::aligned_allocator<{anonymous}::TransparentShapeInfo>, (__gnu_cxx::_Lock_policy)2u>&)’ is implicitly deleted because the default definition would be ill-formed:
     class _Sp_counted_ptr_inplace final : public _Sp_counted_base<_Lp>
           ^
/usr/include/c++/4.8/bits/shared_ptr_base.h:198:7: error: ‘std::_Sp_counted_base<_Lp>::_Sp_counted_base(const std::_Sp_counted_base<_Lp>&) [with __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’ is private
       _Sp_counted_base(_Sp_counted_base const&) = delete;
       ^
/usr/include/c++/4.8/bits/shared_ptr_base.h:379:11: error: within this context
     class _Sp_counted_ptr_inplace final : public _Sp_counted_base<_Lp>
           ^
/usr/include/c++/4.8/bits/shared_ptr_base.h:379:11: error: use of deleted function ‘std::_Sp_counted_base<_Lp>::_Sp_counted_base(const std::_Sp_counted_base<_Lp>&) [with __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’
/usr/include/c++/4.8/bits/shared_ptr_base.h:198:7: error: declared here
       _Sp_counted_base(_Sp_counted_base const&) = delete;
       ^

src/Base/GL1SceneRenderer.cppのコンパイルで発生するエラーだが、何が問題かというとEigenのバージョンが合ってないのである。
いろいろ調べた結果、/usr/local/include にEigen 3.2.8が入っていて、cmakeがこれを引っ張ってきたためにエラーが起きていた。(いつどうして入れたかは忘れたw)
/usr/include にある、Ubuntu14.04がもともと持っているEigen 3.2.0であればコンパイルは通る。
つまり、EIGEN_DIRが/usr/local/include/eigen3になっていたからエラーになるので、これを/usr/include/eigen3に修正すればビルドできる。

今後の修正で、こうしたEigenのバージョン違いによるエラーは起きなくなるということだ。