Closed lletournel closed 4 years ago
I can reproduce your error. The problem is that apparently the define H5_USE_EIGEN
is not defined by the CMake target. The work-around is simple: include Eigen before HighFive. HighFive will detect that Eigen is included and enable its Eigen features.
To facilitate CMake debugging let me report that I get the same error (caused by disabled Eigen features) with:
project(test)
cmake_minimum_required(VERSION 3.16)
set(HIGHFIVE_USE_EIGEN 1)
find_package(HighFive)
find_package(PkgConfig)
pkg_check_modules(EIGEN3 REQUIRED eigen3)
include_directories(SYSTEM ${EIGEN3_INCLUDE_DIRS})
add_executable(test main.cpp)
target_link_libraries(test PRIVATE HighFive)
While I can a failure on the include of Eigen (outside HighFive) when I use
project(test)
cmake_minimum_required(VERSION 3.16)
set(HIGHFIVE_USE_EIGEN 1)
find_package(HighFive)
add_executable(test main.cpp)
target_link_libraries(test PRIVATE HighFive)
(which should be equally legal)
Thank you for the work-around solution, it works indeed. Please let me know if/when the underlying problem is fixed.
I would like to know also if it is possible to specify the path to eigen sources to HighFive. We have a lot of dependencies in FRyDoM, that we manage through FetchContent, including eigen. (The eigen we use in FRyDoM is not the one which might be installed on the system). So the includes "Eigen/Eigen" in HighFive are not currently working...
If you set(HIGHFIVE_USE_EIGEN 0)
before loading HighFive
and you load Eigen yourself you should be good to go. Be sure to either #include <Eigen/Eigen>
before #include <highfive/H5Easy.hpp>
or #define H5_USE_EIGEN
before #include <highfive/H5Easy.hpp>
Well it was more an include problem, but since HighFive is header only, I only included the highfive/include directory along with the HDF5 and Eigen include directories to make it work.
I managed to load and write Eigen::Vector3d data with H5Easy but not with H5 : I still got the "static assertion failed" compile error. It is related to #270 and not ready yet?
All I can really say is that H5Easy's Eigen support is for the moment independent of the Eigen support deeper down in the library. In H5Easy there are several Eigen overloads to make sure that your compiler finds a satisfying match. Maybe the others can comment how this is dealt with deeper down in the library, and if this will be improved in the future.
Ok, thank you very much for the quick answer and all the great job done in HighFive ! I'll go with H5Easy for now and will keep an eye on HighFive future developments.
Hello @lletournel, we are planning on doing more work for Eigen but we haven't set up a timeline for it yet, H5Easy is a sound choice at the moment.
Could you have a look here, give it a try according to your use case and give us some feedback : https://github.com/BlueBrain/HighFive/blob/master/tests/unit/tests_high_five_base.cpp#L1534
Thank you
@lletournel This issue got automatically closed since I mentioned it as related to the last PR. Could you please verify if indeed the issue no longer exists with the latest master, or if it is still there? Either way, as mentioned by @alexsavulescu we should further rework Eigen integration.
Hi Fernando,
I am sorry, I have little to no time anymore to spend on helping you on this issue. As far as I tested with the integration of HighFive in my project, I still got the static assertion failed error, even with the latest master. But since I don't rely on your CMake targets, it may not be surprising... I couldn't give a try also to tests_high_five_base.cpp.
I will come back to this in a few months and, from what I saw, HighFive might change quite a lot ! I will keep you updated then !
Le 02/03/2020 à 22:47, Fernando Pereira a écrit :
@lletournel https://github.com/lletournel This issue got automatically closed since I mentioned it as related to the last PR. Could you please verify if indeed the issue no longer exists with the latest master, or if it is still there? Either way, as mentioned by @alexsavulescu https://github.com/alexsavulescu we should further rework Eigen integration.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/BlueBrain/HighFive/issues/302?email_source=notifications&email_token=AOV4LOZY4SUYLCHOQAPNWKLRFQSO3A5CNFSM4K5RD5OKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENRDU3Y#issuecomment-593640047, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOV4LOZORZYFCBUG57PFOSDRFQSO3ANCNFSM4K5RD5OA.
Hi, I am currently trying HighFive, in order to use it, concurrently with Eigen, in my project (FRyDoM : https://frydom.org/). The code is open-source but you need to register to access the repo (no need to for this issue).
I am having some difficulties using HighFive with Eigen. I created a dummy project, with the following CMakeLists
and example_Eigen.cpp contains
I got a compile error
However the easy_load_dump.cpp compiles and runs correctly. The D dataset with the Eigen matrix is in the example.h5. I had to specify set(CMAKE_CXX_STANDARD 14) as in #269, though.