DGtal-team / DGtalTools

Tools associated with DGtal Library
http://dgtal.org
GNU Lesser General Public License v3.0
44 stars 38 forks source link

Compilation Error on Linux #354

Open raphaellenain opened 5 years ago

raphaellenain commented 5 years ago

I started a new compilation / install of DGtal and DGtalTools on a new install of Ubuntu, from the 1.0 version of DGtal. Here are my commands : cd ~ ; mkdir DGtal_src ; cd DGtal_src ; mkdir dgtal_deps ; cd dgtal_deps sudo apt install git mercurial cmake python autoconf automake bison flex texinfo qt5-default qtcreator qttools5-dev sudo apt install zlib1g-dev sudo apt install libboost-all-dev hg clone https://gmplib.org/repo/gmp-6.1/ gmp ; cd gmp ; ./.bootstrap ; ./configure ; make ; make check ; sudo make install ; cd .. wget http://www.libqglviewer.com/src/libQGLViewer-2.7.1.tar.gz ; tar xfz libQGLViewer-2.7.1.tar.gz ; cd libQGLViewer-2.7.1 ; qmake ; make ; sudo make install ; cd .. sudo apt install libcgal-dev libcgal-demo git clone https://github.com/InsightSoftwareConsortium/ITK ; cd ITK ; mkdir build ; cd build ; cmake .. ; make ; sudo make install ; cd ../.. sudo apt install doxygen sudo apt install fftw3 fftw3-dev sudo apt install libcairo2-dev sudo apt install libeigen3-dev git clone https://gitlab.inria.fr/patate/patate.git ; cd patate ; mkdir build ; cd build ; cmake .. ; make ; sudo make install ; cd ../.. sudo apt install graphicsmagick graphicsmagick-libmagick-dev-compat wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.5/src/hdf5-1.10.5.tar.gz ; tar xfz hdf5-1.10.5.tar.gz ; cd hdf5-1.10.5 ; mkdir build ; cd build ; cmake .. ; make ; sudo make install ; cd ../.. cd .. git clone git://github.com/DGtal-team/DGtal.git ; cd DGtal ; mkdir build ; cd build cmake -DWITH_OPENMP:string=true -DWITH_GMP:string=true -DWITH_CGAL:string=true -DWITH_ITK:string=true -DWITH_CAIRO:string=true -DWITH_HDF5:string=true -DHDF5_ROOT:string="/usr/local/HDF_Group/HDF5/1.10.5/" -DWITH_EIGEN:string=true -DWITH_PATATE:string=true -DWITH_QGLVIEWER:string=true -DWITH_QT5:string=true -DWITH_FFTW3:string=true -DWITH_MAGICK:string=true .. make ; sudo make install cd ../.. git clone https://github.com/DGtal-team/DGtalTools.git ; cd DGtalTools ; mkdir build ; cd build ; cmake .. # After the next line, there is a compile error make

And the errors are :

In file included from /usr/local/include/DGtal/math/linalg/CMatrix.h:45:0, from /usr/local/include/DGtal/math/linalg/CDynamicMatrix.h:45, from /usr/local/include/DGtal/dec/DiscreteExteriorCalculus.h:61, from /home/dgtal_user/DGtal_install/DGtalTools/estimators/volSurfaceRegularization-details/surface_approx.h:7, from /home/dgtal_user/DGtal_install/DGtalTools/estimators/volSurfaceRegularization.cpp:96: /usr/local/include/DGtal/math/linalg/CVectorSpace.h: In instantiation of ‘DGtal::concepts::CVectorSpace<T>::~CVectorSpace() [with T = itkeigen::Matrix<double, -1, 1>]’: /usr/include/boost/concept/usage.hpp:16:29: required from ‘boost::concepts::usage_requirements<Model>::~usage_requirements() [with Model = DGtal::concepts::CVectorSpace<itkeigen::Matrix<double, -1, 1> >]’ /usr/include/boost/concept/detail/general.hpp:39:28: required from ‘static void boost::concepts::requirement<boost::concepts::failed************ Model::************>::failed() [with Model = boost::concepts::usage_requirements<DGtal::concepts::CVectorSpace<itkeigen::Matrix<double, -1, 1> > >]’ /usr/local/include/DGtal/math/linalg/CVectorSpace.h:101:7: required from ‘struct DGtal::concepts::CVectorSpace<itkeigen::Matrix<double, -1, 1> >’ /usr/local/include/DGtal/math/linalg/CVector.h:90:8: required from ‘struct DGtal::concepts::CVector<itkeigen::Matrix<double, -1, 1> >’ /usr/local/include/DGtal/math/linalg/CDynamicVector.h:88:8: [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ] /usr/include/boost/concept/detail/has_constraints.hpp:42:5: required from ‘const bool boost::concepts::not_satisfied<DGtal::concepts::CDynamicVector<itkeigen::Matrix<double, -1, 1> > >::value’ /usr/include/boost/concept/detail/has_constraints.hpp:45:31: required from ‘struct boost::concepts::not_satisfied<DGtal::concepts::CDynamicVector<itkeigen::Matrix<double, -1, 1> > >’ /usr/include/boost/mpl/if.hpp:63:11: required from ‘struct boost::mpl::if_<boost::concepts::not_satisfied<DGtal::concepts::CDynamicVector<itkeigen::Matrix<double, -1, 1> > >, boost::concepts::constraint<DGtal::concepts::CDynamicVector<itkeigen::Matrix<double, -1, 1> > >, boost::concepts::requirement<boost::concepts::failed************ DGtal::concepts::CDynamicVector<itkeigen::Matrix<double, -1, 1> >::************> >’ /usr/include/boost/concept/detail/general.hpp:51:8: required from ‘struct boost::concepts::requirement_<void (*)(DGtal::concepts::CDynamicVector<itkeigen::Matrix<double, -1, 1> >)>’ /usr/local/include/DGtal/dec/DiscreteExteriorCalculus.h:115:5: required from ‘class DGtal::DiscreteExteriorCalculus<2, 3, DGtal::EigenLinearAlgebraBackend>’ /home/dgtal_user/DGtal_install/DGtalTools/estimators/volSurfaceRegularization-details/surface_approx.h:13:17: required from here /usr/local/include/DGtal/math/linalg/CVectorSpace.h:103:11: error: ‘class itkeigen::Matrix<double, -1, 1>’ has no member named ‘clear’; did you mean ‘Scalar’? z.clear(); ~~^~~~~ Scalar /usr/local/include/DGtal/math/linalg/CVectorSpace.h: In instantiation of ‘DGtal::concepts::CVectorSpace<T>::~CVectorSpace() [with T = itkeigen::Matrix<double, -1, -1>]’: /usr/include/boost/concept/usage.hpp:16:29: required from ‘boost::concepts::usage_requirements<Model>::~usage_requirements() [with Model = DGtal::concepts::CVectorSpace<itkeigen::Matrix<double, -1, -1> >]’ /usr/include/boost/concept/detail/general.hpp:39:28: required from ‘static void boost::concepts::requirement<boost::concepts::failed************ Model::************>::failed() [with Model = boost::concepts::usage_requirements<DGtal::concepts::CVectorSpace<itkeigen::Matrix<double, -1, -1> > >]’ /usr/local/include/DGtal/math/linalg/CVectorSpace.h:101:7: required from ‘struct DGtal::concepts::CVectorSpace<itkeigen::Matrix<double, -1, -1> >’ /usr/local/include/DGtal/math/linalg/CMatrix.h:90:8: required from ‘struct DGtal::concepts::CMatrix<itkeigen::Matrix<double, -1, -1> >’ /usr/local/include/DGtal/math/linalg/CDynamicMatrix.h:88:8: [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ] /usr/include/boost/concept/detail/has_constraints.hpp:42:5: required from ‘const bool boost::concepts::not_satisfied<DGtal::concepts::CDynamicMatrix<itkeigen::Matrix<double, -1, -1> > >::value’ /usr/include/boost/concept/detail/has_constraints.hpp:45:31: required from ‘struct boost::concepts::not_satisfied<DGtal::concepts::CDynamicMatrix<itkeigen::Matrix<double, -1, -1> > >’ /usr/include/boost/mpl/if.hpp:63:11: required from ‘struct boost::mpl::if_<boost::concepts::not_satisfied<DGtal::concepts::CDynamicMatrix<itkeigen::Matrix<double, -1, -1> > >, boost::concepts::constraint<DGtal::concepts::CDynamicMatrix<itkeigen::Matrix<double, -1, -1> > >, boost::concepts::requirement<boost::concepts::failed************ DGtal::concepts::CDynamicMatrix<itkeigen::Matrix<double, -1, -1> >::************> >’ /usr/include/boost/concept/detail/general.hpp:51:8: required from ‘struct boost::concepts::requirement_<void (*)(DGtal::concepts::CDynamicMatrix<itkeigen::Matrix<double, -1, -1> >)>’ /usr/local/include/DGtal/dec/DiscreteExteriorCalculus.h:116:5: required from ‘class DGtal::DiscreteExteriorCalculus<2, 3, DGtal::EigenLinearAlgebraBackend>’ /home/dgtal_user/DGtal_install/DGtalTools/estimators/volSurfaceRegularization-details/surface_approx.h:13:17: required from here /usr/local/include/DGtal/math/linalg/CVectorSpace.h:103:11: error: ‘class itkeigen::Matrix<double, -1, -1>’ has no member named ‘clear’; did you mean ‘Scalar’? z.clear(); ~~^~~~~ Scalar In file included from /usr/local/include/DGtal/dec/KForm.h:244:0, from /usr/local/include/DGtal/dec/DiscreteExteriorCalculus.h:54, from /home/dgtal_user/DGtal_install/DGtalTools/estimators/volSurfaceRegularization-details/surface_approx.h:7, from /home/dgtal_user/DGtal_install/DGtalTools/estimators/volSurfaceRegularization.cpp:96: /usr/local/include/DGtal/dec/KForm.ih: In instantiation of ‘void DGtal::KForm<TCalculus, order, duality>::clear() [with TCalculus = DGtal::DiscreteExteriorCalculus<2, 3, DGtal::EigenLinearAlgebraBackend>; unsigned int order = 0; DGtal::Duality duality = (DGtal::Duality)1]’: /usr/local/include/DGtal/dec/KForm.ih:66:10: required from ‘DGtal::KForm<TCalculus, order, duality>::KForm(DGtal::ConstAlias<TPointPredicate>) [with TCalculus = DGtal::DiscreteExteriorCalculus<2, 3, DGtal::EigenLinearAlgebraBackend>; unsigned int order = 0; DGtal::Duality duality = (DGtal::Duality)1]’ /usr/local/include/DGtal/dec/KForm.ih:40:37: required from ‘static DGtal::KForm<Calculus, order, duality> DGtal::KForm<TCalculus, order, duality>::ones(DGtal::ConstAlias<TPointPredicate>) [with TCalculus = DGtal::DiscreteExteriorCalculus<2, 3, DGtal::EigenLinearAlgebraBackend>; unsigned int order = 0; DGtal::Duality duality = (DGtal::Duality)1]’ /home/dgtal_user/DGtal_install/DGtalTools/estimators/volSurfaceRegularization-details/surface_extract.ih:53:103: required from ‘Calculus createCalculusFromShapeBorder(const KSpace&, const Shape&) [with Shape = ImageShape<DGtal::ImageContainerBySTLVector<DGtal::HyperRectDomain<DGtal::SpaceND<3, int> >, unsigned char> >; Calculus = DGtal::DiscreteExteriorCalculus<2, 3, DGtal::EigenLinearAlgebraBackend>; KSpace = DGtal::KhalimskySpaceND<3, int>]’ /home/dgtal_user/DGtal_install/DGtalTools/estimators/volSurfaceRegularization-details/surface_extract.ih:192:54: required from ‘std::tuple<DGtal::DiscreteExteriorCalculus<2, 3, DGtal::EigenLinearAlgebraBackend, int>, itkeigen::Matrix<double, -1, 1, 0, -1, 1> > initCalculusAndNormals(const KSpace&, const Shape&, double) [with Shape = ImageShape<DGtal::ImageContainerBySTLVector<DGtal::HyperRectDomain<DGtal::SpaceND<3, int> >, unsigned char> >; KSpace = DGtal::KhalimskySpaceND<3, int>]’ /home/dgtal_user/DGtal_install/DGtalTools/estimators/volSurfaceRegularization-details/surface_extract.ih:170:50: required from ‘std::tuple<DGtal::DiscreteExteriorCalculus<2, 3, DGtal::EigenLinearAlgebraBackend, int>, itkeigen::Matrix<double, -1, 1, 0, -1, 1> > initCalculusAndNormalsWithNoise(const KSpace&, const Shape&, double, double) [with Shape = ImageShape<DGtal::ImageContainerBySTLVector<DGtal::HyperRectDomain<DGtal::SpaceND<3, int> >, unsigned char> >; KSpace = DGtal::KhalimskySpaceND<3, int>]’ /home/dgtal_user/DGtal_install/DGtalTools/estimators/volSurfaceRegularization.cpp:211:102: required from here /usr/local/include/DGtal/dec/KForm.ih:120:17: error: ‘DGtal::KForm<DGtal::DiscreteExteriorCalculus<2, 3, DGtal::EigenLinearAlgebraBackend>, 0, (DGtal::Duality)1>::Container {aka class itkeigen::Matrix<double, -1, 1>}’ has no member named ‘clear’; did you mean ‘Scalar’? myContainer.clear(); ~~~~~~~~~~~~^~~~~ Scalar /usr/local/include/DGtal/dec/KForm.ih: In instantiation of ‘void DGtal::KForm<TCalculus, order, duality>::clear() [with TCalculus = DGtal::DiscreteExteriorCalculus<2, 3, DGtal::EigenLinearAlgebraBackend>; unsigned int order = 0; DGtal::Duality duality = (DGtal::Duality)0]’: /usr/local/include/DGtal/dec/KForm.ih:66:10: required from ‘DGtal::KForm<TCalculus, order, duality>::KForm(DGtal::ConstAlias<TPointPredicate>) [with TCalculus = DGtal::DiscreteExteriorCalculus<2, 3, DGtal::EigenLinearAlgebraBackend>; unsigned int order = 0; DGtal::Duality duality = (DGtal::Duality)0]’ /usr/local/include/DGtal/dec/KForm.ih:40:37: required from ‘static DGtal::KForm<Calculus, order, duality> DGtal::KForm<TCalculus, order, duality>::ones(DGtal::ConstAlias<TPointPredicate>) [with TCalculus = DGtal::DiscreteExteriorCalculus<2, 3, DGtal::EigenLinearAlgebraBackend>; unsigned int order = 0; DGtal::Duality duality = (DGtal::Duality)0]’ /home/dgtal_user/DGtal_install/DGtalTools/estimators/volSurfaceRegularization-details/surface_extract.ih:54:103: required from ‘Calculus createCalculusFromShapeBorder(const KSpace&, const Shape&) [with Shape = ImageShape<DGtal::ImageContainerBySTLVector<DGtal::HyperRectDomain<DGtal::SpaceND<3, int> >, unsigned char> >; Calculus = DGtal::DiscreteExteriorCalculus<2, 3, DGtal::EigenLinearAlgebraBackend>; KSpace = DGtal::KhalimskySpaceND<3, int>]’ /home/dgtal_user/DGtal_install/DGtalTools/estimators/volSurfaceRegularization-details/surface_extract.ih:192:54: required from ‘std::tuple<DGtal::DiscreteExteriorCalculus<2, 3, DGtal::EigenLinearAlgebraBackend, int>, itkeigen::Matrix<double, -1, 1, 0, -1, 1> > initCalculusAndNormals(const KSpace&, const Shape&, double) [with Shape = ImageShape<DGtal::ImageContainerBySTLVector<DGtal::HyperRectDomain<DGtal::SpaceND<3, int> >, unsigned char> >; KSpace = DGtal::KhalimskySpaceND<3, int>]’ /home/dgtal_user/DGtal_install/DGtalTools/estimators/volSurfaceRegularization-details/surface_extract.ih:170:50: required from ‘std::tuple<DGtal::DiscreteExteriorCalculus<2, 3, DGtal::EigenLinearAlgebraBackend, int>, itkeigen::Matrix<double, -1, 1, 0, -1, 1> > initCalculusAndNormalsWithNoise(const KSpace&, const Shape&, double, double) [with Shape = ImageShape<DGtal::ImageContainerBySTLVector<DGtal::HyperRectDomain<DGtal::SpaceND<3, int> >, unsigned char> >; KSpace = DGtal::KhalimskySpaceND<3, int>]’ /home/dgtal_user/DGtal_install/DGtalTools/estimators/volSurfaceRegularization.cpp:211:102: required from here /usr/local/include/DGtal/dec/KForm.ih:120:17: error: ‘DGtal::KForm<DGtal::DiscreteExteriorCalculus<2, 3, DGtal::EigenLinearAlgebraBackend>, 0, (DGtal::Duality)0>::Container {aka class itkeigen::Matrix<double, -1, 1>}’ has no member named ‘clear’; did you mean ‘Scalar’? myContainer.clear(); ~~~~~~~~~~~~^~~~~ Scalar estimators/CMakeFiles/volSurfaceRegularization.dir/build.make:62: recipe for target 'estimators/CMakeFiles/volSurfaceRegularization.dir/volSurfaceRegularization.cpp.o' failed make[2]: *** [estimators/CMakeFiles/volSurfaceRegularization.dir/volSurfaceRegularization.cpp.o] Error 1 CMakeFiles/Makefile2:1060: recipe for target 'estimators/CMakeFiles/volSurfaceRegularization.dir/all' failed make[1]: *** [estimators/CMakeFiles/volSurfaceRegularization.dir/all] Error 2 Makefile:129: recipe for target 'all' failed make: *** [all] Error 2

kerautret commented 5 years ago

Thanks @raphaellenain for the report. As @dcoeurjo mention it is related to ITK/Eigen and @phcerdan has transmit the issue. @phcerdan have you some news ? If you have a link of the bug report I am interested.

phcerdan commented 5 years ago

As @dcoeurjo mention it is related to ITK/Eigen and @phcerdan has transmit the issue. @phcerdan have you some news ?

I fixed the Eigen problems in ITK (hopefully!). Eigen Related phcerdan PR's Search in ITK

You are going to get the same results using your system Eigen for ITK. Try compile ITK with -DITK_USE_SYSTEM_EIGEN:BOOL=ON. This way DGtal and ITK will share the same system Eigen.

However, this seems a valid DGtalTool error. The matrix in ITK computation might have changed from the "Dynamic" vnl matrix to a fixed EigenMatrix for that case. That's not an ITK bug.

dcoeurjo commented 5 years ago

Thanks @phcerdan.

If it works with the suggested commandline I would be in favor of having this flag activated by default.

kerautret commented 5 years ago

+1 thanks @phcerdan. @dcoeurjo for the command line it looks difficult since it is the option to compile ITK itself. If I well understand perhaps a solution in DGtal could be force to use eigen from ITK when ITK is present ? @phcerdan let me know If I am wrong (perhaps not easy to do it in cmake but if it can fix the issue that could be nice).

dcoeurjo commented 5 years ago

Oh I see..

phcerdan commented 5 years ago

I think this is because some internals (the matrices) changed in ITK, but it is not related to CMake, or what Eigen to use, using -DITK_USE_SYSTEM_EIGEN won't solve it, neither if DGtal uses the internal ITKEigen3.

So, I think dealing with the right matrix (changed from vnl_matrix to EigenMatrix) is something DGtalTools has to fix. And that's what the error shows.

perhaps a solution in DGtal could be force to use eigen from ITK when ITK is present ?

We could do that, but this particular problem will stay.

raphaellenain commented 5 years ago

I confirm that compiling ITK with -DITK_USE_SYSTEM_EIGEN cmake option don't solve the problem. In a first time, I will compile DGtal without ITK.

phcerdan commented 4 years ago

Digging a little bit here, the problem is that an Eigen3::matrrix does not have a clear() method, so the Concept checking for CVectorSpace fails.

This is triggered when using volSurfaceRegularization in DGtalTools.

kerautret commented 4 years ago

thanks @phcerdan! perhaps @dcoeurjo @JacquesOlivierLachaud or @elcerdo can have a look to a workaround to the clear() miss.