FindEigen3.cmake
kevin-keraudren opened this issue · 19 comments
Two points regarding Eigen:
- It seems that Eigen is a requirement for VTK, so switching WITH_VTK ON should automatically switch
WITH_EIGEN ON, see error messages below:
IRTK/Modules/PolyData/src/irtkLinearVolumeParameterizer.cc:26:10: fatal error:
'Eigen/IterativeLinearSolvers' file not found
#include <Eigen/IterativeLinearSolvers>
^
IRTK/Modules/PolyData/src/irtkAsConformalAsPossibleVolumeParameterizer.cc:26:10: fatal error:
'Eigen/SVD' file not found
#include <Eigen/SVD>
^
- Switching WITH_EIGEN ON leads to "cannot find FindEigen3.cmake",
a quick fix is:
cd IRTK/CMake
wget https://raw.githubusercontent.com/RainerKuemmerle/g2o/master/cmake_modules/FindEigen3.cmake
WITH_EIGEN
should actually be ON
by default as it is required in particular by irtkMatrix
functions. I would even argue we had decided it to not really be an optional dependency at all (though it's still good to have the preprocessor flag option, but not the CMake option... which could also be advanced if it shall be kept).
W.r.t. point 2. If you are on Ubuntu it is probably cleaner to just run
apt-get install libeigen3-dev
with administrative privileges.
Same applies to:
libvtk6-dev
libflann-dev
libnifti-dev
zlib1g-dev
And w.r.t. point one it seems to me that the problem has nothing to do with having VTK on (unless having VTK on triggers the compilation of IRTK's PolyData). But anyway, I agree with Andreas that Eigen should be ON by default or required (I was actually surprised it was not)
unless having VTK on triggers the compilation of IRTK's PolyData
That's what's happening.
if(WITH_VTK)
add_subdirectory(PolyData)
endif()
This does not qualify as required to me:
grep -nr HAVE_EIGEN Modules/
Modules/Transformation/src/irtkAffineTransformation.cc:122:#if defined(HAVE_EIGEN) || defined(HAVE_VNL)
Modules/Geometry/src/irtkMatrix.cc:19:#if defined(HAVE_EIGEN)
Modules/Geometry/src/irtkMatrix.cc:662:#ifdef HAVE_EIGEN
Modules/Geometry/src/irtkMatrix.cc:689:#ifdef HAVE_EIGEN
Modules/Geometry/src/irtkMatrix.cc:744:#ifdef HAVE_EIGEN
Modules/Geometry/src/irtkMatrix.cc:1094:#ifdef HAVE_EIGEN
Modules/Geometry/src/irtkMatrix.cc:1528:#if defined(HAVE_EIGEN)
Modules/Geometry/src/irtkVector.cc:169:#ifdef HAVE_EIGEN
Modules/Geometry/include/irtkVector.h:23:#ifdef HAVE_EIGEN
Modules/Geometry/include/irtkVector.h:268:#ifdef HAVE_EIGEN
Modules/Geometry/include/irtkMatrix.h:24:#ifdef HAVE_EIGEN
Modules/Geometry/include/irtkMatrix.h:420:#ifdef HAVE_EIGEN
So you guys want EIGEN and VTK opt-out instead of opt-in? Also seems that the build of PolyData should be conditional on both EIGEN and VTK, not VTK alone as it is now.
Does that sound like an appropriate solution to you guys?
@kevin-keraudren Thanks for reporting this by the way. Besides, next time, could you please give details on which system you are trying to install IRTK?
Again, same story. The conditional compilation is there in case we have alternative implementations for those matrix functions in the future maybe using some other external library if available instead or our own. Just grepping code and map every conditional if to a user build option is not a good argument. You can also just add this macro definition by default without a user option.
So you guys want EIGEN and VTK opt-out instead of opt-in? Also seems that the build of PolyData should be conditional on both EIGEN and VTK, not VTK alone as it is now.
Does that sound like an appropriate solution to you guys?
I'm not entirely clear about the meaning of opt-in/-out. I would make Eigen either required (no build option, just look for it and add the macro definition) or an advanced option that is ON by default.
VTK can be an option that is OFF by default, as the image registration (and segmentation?) tools don't need it. But the registration needs it if the user also wants to register point sets such as landmarks or surfaces.
PolyData should be conditional on both EIGEN and VTK, not VTK alone as it is now.
Possible, but not actually my intention. It is used in a single class which could be excluded if no Eigen available. But my assumption was that Eigen is required by IRTK in which case it is not so much conditional any more.
Regarding Kevin's reported issue with Eigen3Config.cmake
, I am having the same problem when trying to build this IRTK. The reason is that I am not using an installation of the Eigen library, which might include such CMake package configuration file (I don't know), but the source tree of this header-only library which does not require any CMake configuration, build, and following installation. For this to work, we need the FindEigen3.cmake
module in our CMake folder.
P.S.: I added a customised FindEigen3.cmake module, but cannot commit yet and send a PR because of other unrelated build issues to test my changes...
@kevin-keraudren You should now be able to specify the path to your custom Eigen install via EIGEN3_INCLUDE_DIR
.
@schuhschuh I figured Kevin might be in the rush to try IRTK out, so I merged that one since it works verbatim. Feel free to submit a PR with your specific changes, and a description as to why they are needed please.
Hi guys, thanks a lot for your commitment to this project, that's awesome!
Just a quick message to say I did not "try" to install IRTK, I just installed it. I thought it was clear from my second point where I said "a quick fix", which is the same as @schuhschuh 's pull request: https://github.com/BioMedIA/IRTK/pull/35/files
Hi guys, thanks a lot for your commitment to this project, that's awesome!
No prob let us know if you need anything. I should set-up our Gitter chat for the project soon so we can also support users like you more dynamically in the future.
@ghisvail or we can host an instance of that: https://rocket.chat/ ...
@jopasserat Looks awesome. Think you could deploy that ? Would be cool if we could give it a test drive first.
i think i can...
docker pull rocketchat/rocket.chat
Awesome. Let's move that discussion privately and leave this issue quiet.