# Dolfinx build issue: Found serial HDF5 build, MPI HDF5 build required

**URL:** <https://fenicsproject.discourse.group/t/dolfinx-build-issue-found-serial-hdf5-build-mpi-hdf5-build-required/13893>\
**Category:** General\
**Tags:** dolfinx\
**Created:** [March 12, 2024, 3:02pm UTC](https://fenicsproject.discourse.group/t/dolfinx-build-issue-found-serial-hdf5-build-mpi-hdf5-build-required/13893 "2024-03-12T15:02:17Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mekong](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/mekong/32/7729_2.png) [@mekong](https://fenicsproject.discourse.group/u/mekong)\
**Post date:** [March 12, 2024, 3:02pm UTC](https://fenicsproject.discourse.group/t/dolfinx-build-issue-found-serial-hdf5-build-mpi-hdf5-build-required/13893/1 "2024-03-12T15:02:17Z")

</div>

Dear all,  
I am totally new to Fenics and I am having troubles with the installation. I am on OS Sonoma 14.1, and I am trying to install Dolfinx . I followed the build procedure for C++ shown [here](https://docs.fenicsproject.org/dolfinx/main/python/installation.html):

`cd dolfinx-main/cpp; mkdir build; cd build; cmake ..`

and I get the following output error:

```auto
[...]
CMake Error at CMakeLists.txt:334 (message):
  Found serial HDF5 build, MPI HDF5 build required, try setting HDF5_DIR or
  HDF5_ROOT

```

I installed hdf5 1.14 by downloading the .tar.gz, then

```auto
./configure --enable-parallel --enable-shared
make 
sudo make install

```

If I remove `--enable-parallel` , `--enable-shared` or both, I get the same error.

Do you know how to fix this ?  
Thank you !

---

<div class="post-metadata">

**Author:** ![francesco-ballarin](https://avatars.discourse-cdn.com/v4/letter/f/f05b48/32.png) [@francesco-ballarin](https://fenicsproject.discourse.group/u/francesco-ballarin)\
**Post date:** [March 12, 2024, 3:17pm UTC](https://fenicsproject.discourse.group/t/dolfinx-build-issue-found-serial-hdf5-build-mpi-hdf5-build-required/13893/2 "2024-03-12T15:17:52Z")

</div>

You may want to

> [@mekong](#):
>
> ```auto
> try setting HDF5_DIR or HDF5_ROOT
> 
> ```

to the directory where

> [@mekong](#):
>
> ```auto
> sudo make install
> 
> ```

installed your custom version of hdf5. To be extra safe, delete the `build` folder before running `cmake` again.

---

<div class="post-metadata">

**Author:** ![mekong](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/mekong/32/7729_2.png) [@mekong](https://fenicsproject.discourse.group/u/mekong)\
**Post date:** [March 12, 2024, 3:36pm UTC](https://fenicsproject.discourse.group/t/dolfinx-build-issue-found-serial-hdf5-build-mpi-hdf5-build-required/13893/3 "2024-03-12T15:36:02Z")

</div>

> [@mekong](#):
>
> `setting HDF5_DIR`

Hello, I don’t understand, where should I set `HDF5_DIR` ? In .bash\_profile or .zprofile ?

---

<div class="post-metadata">

**Author:** ![francesco-ballarin](https://avatars.discourse-cdn.com/v4/letter/f/f05b48/32.png) [@francesco-ballarin](https://fenicsproject.discourse.group/u/francesco-ballarin)\
**Post date:** [March 12, 2024, 3:46pm UTC](https://fenicsproject.discourse.group/t/dolfinx-build-issue-found-serial-hdf5-build-mpi-hdf5-build-required/13893/4 "2024-03-12T15:46:54Z")

</div>

Try with `export HDF5_ROOT=/path/to/hdf5` in your current terminal, no need to modify profile files, delete `build` and run `cmake` again.

You may use tools like `ccmake` in your build directory to double check whether this setting makes any difference.

---

<div class="post-metadata">

**Author:** ![mekong](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/mekong/32/7729_2.png) [@mekong](https://fenicsproject.discourse.group/u/mekong)\
**Post date:** [March 12, 2024, 3:57pm UTC](https://fenicsproject.discourse.group/t/dolfinx-build-issue-found-serial-hdf5-build-mpi-hdf5-build-required/13893/5 "2024-03-12T15:57:33Z")

</div>

> [@francesco-ballarin](#):
>
> export HDF5\_ROOT=/path/to/hdf5

Hello,  
I am not sure what is the right folder to set to `/path/to/hdf5`. It may be `/Applications/hdf5-1.14.3/hdf5/` or `/Applications/hdf5-1.14.3/hdf5/bin/`? Here is what is inside these folders:

` % ls /Applications/hdf5-1.14.3/hdf5/bin h5cc h5debug h5dump h5import h5mkgrp h5perf_serial h5repart h5unjam h5clear h5delete h5format_convert	h5jam h5pcc h5redeploy h5stat h5watch h5copy h5diff h5fuse.sh h5ls h5perf h5repack h5tools_test_utils	ph5diff`

` % ls /Applications/hdf5-1.14.3/hdf5/ bin	include	lib	share`

Anyway, I removed the `build` folder, then did

`export HDF5_ROOT=/Applications/hdf5-1.14.3/hdf5/bin; mkdir build; cd build; cmake .. `  
but I still get the same error message. I also get the same error message if I replace `/Applications/hdf5-1.14.3/hdf5/bin` with `/Applications/hdf5-1.14.3/hdf5/`

---

<div class="post-metadata">

**Author:** ![francesco-ballarin](https://avatars.discourse-cdn.com/v4/letter/f/f05b48/32.png) [@francesco-ballarin](https://fenicsproject.discourse.group/u/francesco-ballarin)\
**Post date:** [March 12, 2024, 5:44pm UTC](https://fenicsproject.discourse.group/t/dolfinx-build-issue-found-serial-hdf5-build-mpi-hdf5-build-required/13893/6 "2024-03-12T17:44:04Z")

</div>

It’s definitely the one without bin. Double check with ccmake that it the one actually being used while building dolfinx.

---

<div class="post-metadata">

**Author:** ![mekong](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/mekong/32/7729_2.png) [@mekong](https://fenicsproject.discourse.group/u/mekong)\
**Post date:** [March 12, 2024, 9:49pm UTC](https://fenicsproject.discourse.group/t/dolfinx-build-issue-found-serial-hdf5-build-mpi-hdf5-build-required/13893/7 "2024-03-12T21:49:21Z")

</div>

Hello,  
I used the one without bin, here is the output given by ccmake :

```auto
$ccmake .. 

                                                    Page 1 of 1
 BUILD_SHARED_LIBS ON                                                                                                                              
 Basix_DIR /usr/local/lib/cmake/basix                                                                                                      
 Boost_INCLUDE_DIR /opt/homebrew/include                                                                                                           
 Boost_TIMER_LIBRARY_RELEASE /opt/homebrew/lib/libboost_timer-mt.dylib                                                                                       
 CMAKE_BUILD_TYPE RelWithDebInfo                                                                                                                  
 CMAKE_INSTALL_PREFIX /usr/local                                                                                                                      
 CMAKE_INSTALL_RPATH_USE_LINK_P ON                                                                                                                              
 CMAKE_OSX_ARCHITECTURES                                                                                                                                          
 CMAKE_OSX_DEPLOYMENT_TARGET 14.1                                                                                                                            
 CMAKE_OSX_SYSROOT /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk                              
 DOLFINX_ENABLE_ADIOS2 ON                                                                                                                              
 DOLFINX_ENABLE_KAHIP OFF                                                                                                                             
 DOLFINX_ENABLE_PARMETIS ON                                                                                                                              
 DOLFINX_ENABLE_SCOTCH ON                                                                                                                              
 DOLFINX_ENABLE_SLEPC ON                                                                                                                              
 DOLFINX_SKIP_BUILD_TESTS OFF                                                                                                                             
 DOLFINX_UFCX_PYTHON ON                                                                                                                              
 DOXYGEN_DOLFINX_VERSION 0.8.0.0                                                                                                                         
 GIT_FOUND /opt/homebrew/bin/git                                                                                                           
 HDF5_C_LIBRARY_dl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/libdl.tbd            
 HDF5_C_LIBRARY_hdf5 /Applications/hdf5-1.14.3/hdf5/lib/libhdf5.dylib                                                                                
 HDF5_C_LIBRARY_m /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/libm.tbd             
 HDF5_C_LIBRARY_z /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/libz.tbd             
 _REQUIRE_ADIOS2 OFF                                                                                                                             
 _REQUIRE_KAHIP OFF                                                                                                                             
 _REQUIRE_PARMETIS OFF                                                                                                                             
 _REQUIRE_SCOTCH OFF                                                                                                                             
 _REQUIRE_SLEPC OFF                                                                                                                             
 _UFCX_HEADER _UFCX_HEADER-NOTFOUND                                                                                                           
 pugixml_DIR /opt/homebrew/lib/cmake/pugixml

```

I don’t see any `HDF5_ROOT` though, I don’t understand …

---

<div class="post-metadata">

**Author:** ![francesco-ballarin](https://avatars.discourse-cdn.com/v4/letter/f/f05b48/32.png) [@francesco-ballarin](https://fenicsproject.discourse.group/u/francesco-ballarin)\
**Post date:** [March 13, 2024, 9:32am UTC](https://fenicsproject.discourse.group/t/dolfinx-build-issue-found-serial-hdf5-build-mpi-hdf5-build-required/13893/8 "2024-03-13T09:32:22Z")

</div>

This is the relevant line

> [@mekong](#):
>
> `HDF5_C_LIBRARY_hdf5 /Applications/hdf5-1.14.3/hdf5/lib/libhdf5.dylib`

which seems to confirm that hdf5 was taken from the path you provided.

However, are you sure that it is actually the path were you installed your custom hdf5 version? I am no mac user, but it seems odd that

> [@mekong](#):
>
> ```auto
> Basix_DIR /usr/local/lib/cmake/basix                                                                                                      
> CMAKE_INSTALL_PREFIX /usr/local                                                                                                                      
> 
> ```

basix and dolfinx would get installed in `/usr/local` when you build them manually, which would make me think that also your custom hdf5 installation was installed in `/usr/local`

---

<div class="post-metadata">

**Author:** ![mekong](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/mekong/32/7729_2.png) [@mekong](https://fenicsproject.discourse.group/u/mekong)\
**Post date:** [March 13, 2024, 10:35am UTC](https://fenicsproject.discourse.group/t/dolfinx-build-issue-found-serial-hdf5-build-mpi-hdf5-build-required/13893/9 "2024-03-13T10:35:07Z")

</div>

Hello,  
The output of ` sudo make install` in the hdf5 installation directory is

```auto
[...]
+ /usr/bin/install -c ./ex_table_12.c /Applications/hdf5-1.14.3/hdf5/share/hdf5_examples/hl/c/.
+ /usr/bin/install -c ./ex_ds1.c /Applications/hdf5-1.14.3/hdf5/share/hdf5_examples/hl/c/.
+ /usr/bin/install -c ./image24pixel.txt /Applications/hdf5-1.14.3/hdf5/share/hdf5_examples/hl/c/.
[...]

```

so I guess that my custom installation of hdf5 was installed in /Applications/hdf5-1.14.3/hdf5/.

Now if I do `export HDF5_ROOT=/Applications/hdf5-1.14.3/hdf5/` and

- install hdft with ` ./configure; make; make install`,
- run `cmake ..` in `/Applications/dolfinx-main/cpp/build`
- I get the error message of the original post.

However, if I

- install hdf5 with ` ./configure --enable-parallel --enable-shared; make; make install`
- run `cmake ..` in `/Applications/dolfinx-main/cpp/build`
- I get another error message `Could NOT find UFCx (missing: UFCX_INCLUDE_DIRS UFCX_SIGNATURE UFCX_VERSION) (Required is at least version "0.7")`. Let alone the new error message, this means that adding the flags to configure fixed the issue with hdf5?

Thanks

---

<div class="post-metadata">

**Author:** ![francesco-ballarin](https://avatars.discourse-cdn.com/v4/letter/f/f05b48/32.png) [@francesco-ballarin](https://fenicsproject.discourse.group/u/francesco-ballarin)\
**Post date:** [March 13, 2024, 2:07pm UTC](https://fenicsproject.discourse.group/t/dolfinx-build-issue-found-serial-hdf5-build-mpi-hdf5-build-required/13893/10 "2024-03-13T14:07:22Z")

</div>

It means that now hdf5 is ok, the ufcx error is unrelated, and I will look into that in the other post you opened.

---

<div class="post-metadata">

**Author:** ![mekong](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/mekong/32/7729_2.png) [@mekong](https://fenicsproject.discourse.group/u/mekong)\
**Post date:** [March 13, 2024, 4:43pm UTC](https://fenicsproject.discourse.group/t/dolfinx-build-issue-found-serial-hdf5-build-mpi-hdf5-build-required/13893/11 "2024-03-13T16:43:12Z")

</div>

Great, Thank you!

Best,
