DGtal-team / DGtal

Digital Geometry Tools and Algorithm Library
https://dgtal.org
GNU Lesser General Public License v3.0
370 stars 115 forks source link

Compilation error of examples/dec/examplePropagation.cpp with Eigen3 (3.2.92) and gcc 5.4 #1361

Closed JacquesOlivierLachaud closed 5 years ago

JacquesOlivierLachaud commented 5 years ago

I have a compilation problem on examples/dec/examplePropagation.cpp with Eigen3 on Ubuntu 16.04 LTS, package libeigen3-dev par defaut (3.2.92). [100%] Building CXX object examples/dec/CMakeFiles/examplePropagation.dir/examplePropagation.cpp.o In file included from /usr/include/eigen3/Eigen/Eigenvalues:38:0, from /usr/include/eigen3/Eigen/Dense:7, from /home/lachaud/GITHUB/DGtal/src/DGtal/math/linalg/EigenSupport.h:65, from /home/lachaud/GITHUB/DGtal/examples/dec/examplePropagation.cpp:11: /usr/include/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h: In instantiation of ‘Eigen::SelfAdjointEigenSolver<MatrixType>& Eigen::SelfAdjointEigenSolver<_MatrixType>::compute(const Eigen::EigenBase<OtherDerived>&, int) [with InputType = Eigen::SparseMatrix<double, 0, long int>; _MatrixType = Eigen::Matrix<double, -1, -1>]’: /usr/include/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h:168:14: required from ‘Eigen::SelfAdjointEigenSolver<_MatrixType>::SelfAdjointEigenSolver(const Eigen::EigenBase<OtherDerived>&, int) [with InputType = Eigen::SparseMatrix<double, 0, long int>; _MatrixType = Eigen::Matrix<double, -1, -1>]’ /home/lachaud/GITHUB/DGtal/examples/dec/examplePropagation.cpp:96:65: required from here /usr/include/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h:414:51: error: no match for call to ‘(const Eigen::SparseMatrix<double, 0, long int>) (int, int)’ m_eivalues.coeffRef(0,0) = numext::real(matrix(0,0)); ^ examples/dec/CMakeFiles/examplePropagation.dir/build.make:62 : la recette pour la cible « examples/dec/CMakeFiles/examplePropagation.dir/examplePropagation.cpp.o » a échouée make[3]: *** [examples/dec/CMakeFiles/examplePropagation.dir/examplePropagation.cpp.o] Erreur 1 CMakeFiles/Makefile2:6574 : la recette pour la cible « examples/dec/CMakeFiles/examplePropagation.dir/all » a échouée make[2]: *** [examples/dec/CMakeFiles/examplePropagation.dir/all] Erreur 2 CMakeFiles/Makefile2:6586 : la recette pour la cible « examples/dec/CMakeFiles/examplePropagation.dir/rule » a échouée make[1]: *** [examples/dec/CMakeFiles/examplePropagation.dir/rule] Erreur 2 Makefile:2251 : la recette pour la cible « examplePropagation » a échouée When looking at file SparseMatrix, I do not understand since there seems to have such a public constructor. gcc version is 5.4.0.

I tested with clang (3.8.0), default in ubuntu and I got the same issue. On a forum https://stackoverflow.com/questions/19701977/compilation-error-using-template-programming-with-eigen-c-library it says more or less that a call to matrix(0,0) is a bad idea, but this is eigen code. Do you have compilation issues also with eigen3 ?

rolanddenis commented 5 years ago

No error under Ubuntu/16.04 with Clang/6.0 or GNU/5.5 but using Eigen/3.3.3. Maybe a fixed bug ?

JacquesOlivierLachaud commented 5 years ago

I found bug1394 fixed in Eigen 3.3. I check if it works and I close the issue.

JacquesOlivierLachaud commented 5 years ago

It works when replacing Eigen 3.2.92 with Eigen 3.3. I close the issue.