# CMake Error (could not find HDF5)

**URL:** <https://openmc.discourse.group/t/cmake-error-could-not-find-hdf5/246>\
**Category:** User Support\
**Created:** [November 8, 2016, 8:07pm UTC](https://openmc.discourse.group/t/cmake-error-could-not-find-hdf5/246 "2016-11-08T20:07:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amani\_Chaniour](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@Amani\_Chaniour](https://openmc.discourse.group/u/Amani_Chaniour)\
**Post date:** [November 8, 2016, 8:07pm UTC](https://openmc.discourse.group/t/cmake-error-could-not-find-hdf5/246/1 "2016-11-08T20:07:35Z")

</div>

Hello,

I am trying to install OpenMC to work on a class project. I installed HDF5 but this is what I get with the cmake:

– Checking whether Fortran compiler has -isysroot

– Checking whether Fortran compiler has -isysroot - yes

– Checking whether Fortran compiler supports OSX deployment target flag

– Checking whether Fortran compiler supports OSX deployment target flag - yes

– Detected MPI wrapper: mpif90

– Could NOT find HDF5 (missing: HDF5\_INCLUDE\_DIRS)

CMake Error at CMakeLists.txt:74 (message):

Could not find HDF5

– Configuring incomplete, errors occurred!

See also “/path/to/openmc/build/CMakeFiles/CMakeOutput.log”.

Amani

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [November 9, 2016, 4:22am UTC](https://openmc.discourse.group/t/cmake-error-could-not-find-hdf5/246/2 "2016-11-09T04:22:26Z")

</div>

Hi Amani,

Did you try to set the HDF5\_ROOT environment variable as described [here](http://openmc.readthedocs.io/en/latest/usersguide/install.html#selecting-hdf5-installation)?

Best regards,  
Paul

---

<div class="post-metadata">

**Author:** ![Amani\_Chaniour](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@Amani\_Chaniour](https://openmc.discourse.group/u/Amani_Chaniour)\
**Post date:** [November 9, 2016, 6:58pm UTC](https://openmc.discourse.group/t/cmake-error-could-not-find-hdf5/246/3 "2016-11-09T18:58:42Z")

</div>

Hi Paul,

Thank you for your answer. I tried it but I still get the same error.

Amani

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [November 9, 2016, 7:00pm UTC](https://openmc.discourse.group/t/cmake-error-could-not-find-hdf5/246/4 "2016-11-09T19:00:13Z")

</div>

How did you install HDF5 on your system?

---

<div class="post-metadata">

**Author:** ![Amani\_Chaniour](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@Amani\_Chaniour](https://openmc.discourse.group/u/Amani_Chaniour)\
**Post date:** [November 9, 2016, 8:59pm UTC](https://openmc.discourse.group/t/cmake-error-could-not-find-hdf5/246/5 "2016-11-09T20:59:07Z")

</div>

I followed these instructions:

gunzip \< hdf5-1.8.17.tar.gz | tar xf - cd hdf5-1.8.17  
 ./configure --prefix=/usr/local/hdf5 \<more configure\_flags\> make  
 make check # run test suite. make install

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [November 10, 2016, 4:47am UTC](https://openmc.discourse.group/t/cmake-error-could-not-find-hdf5/246/6 "2016-11-10T04:47:41Z")

</div>

Did your include --enable-fortran and --enable-fortran2003?

---

<div class="post-metadata">

**Author:** ![Mirza\_Younis\_Baig](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@Mirza\_Younis\_Baig](https://openmc.discourse.group/u/Mirza_Younis_Baig)\
**Post date:** [November 15, 2016, 5:46pm UTC](https://openmc.discourse.group/t/cmake-error-could-not-find-hdf5/246/7 "2016-11-15T17:46:13Z")

</div>

Hi Amani,

If you are using Ubuntu 16.04 LTS then you may try,

gunzip \< hdf5-1.8.17.tar.gz | tar xf - cd hdf5-1.8.17  
 sudo mkdir /opt/phdf5 sudo chown -R username /opt/phdf5  
 CC=/opt/mpich/3.1.3-gnu/bin/mpicc FC=/opt/mpich/3.1.3-gnu/bin/mpif90 ./configure --prefix=/opt/phdf5/1.8.17-gnu --enable-fortran --enable-fortran2003 --enable-parallel make -j  
$ make install

In 4th command line use your user name where specified. It worked for me. Hope it works for you also.  
Best,  
Mirza
