Parallel HDF5 crashing on build

I am using a MPI-enabled HDF5 and suddenly calling up from the Julia package manager fails with

ERROR: Error building `HDF5`: 

signal (11): Segmentation fault: 11
in expression starting at /Users/chiel/.julia/packages/HDF5/THb0i/deps/build.jl:8

signal (4): Illegal instruction: 4
in expression starting at /Users/chiel/.julia/packages/HDF5/THb0i/deps/build.jl:8

Line 8 of the mentioned file contains:

  1 using Libdl
  2 
  3 const depsfile = joinpath(@__DIR__, "deps.jl")
  4 
  5 libpath = get(ENV, "JULIA_HDF5_PATH",
  6                 get(ENV, "JULIA_HDF5_LIBRARY_PATH", nothing)) # legacy env variable for compatibility
  7 
  8 new_contents = if libpath === nothing
  9     # By default, use HDF5_jll
 10     """
 11     # This file is automatically generated
 12     # Do not edit
 13     using HDF5_jll
 14     check_deps() = nothing
 15     """
 16 else
 17     @info "using system HDF5"
 18 
 19     libhdf5 = find_library("libhdf5", [libpath, joinpath(libpath, "lib"), joinpath(libpath, "lib64")])
 20     libhdf5_hl = find_library("libhdf5_hl", [libpath, joinpath(libpath, "lib"), joinpath(libpath, "lib64")])
 21 
 22     isempty(libhdf5) && error("libhdf5 could not be found")
 23     isempty(libhdf5_hl) && error("libhdf5_hl could not be found")
 24 
 25     libhdf5_size = filesize(dlpath(libhdf5))
 26 
 27     """
 28     # This file is automatically generated
 29     # Do not edit
 30 
 31     function check_deps()
 32         if libhdf5_size != filesize(Libdl.dlpath(libhdf5))
 33             error("HDF5 library has changed, re-run Pkg.build(\\\"HDF5\\\")")
 34         end
 35         if h5_get_libversion() < v"1.10.4"
 36             error("HDF5.jl requires ≥ v1.10.4 of the HDF5 library.")
 37         end
 38     end
 39     $(:(const libhdf5 = $libhdf5))
 40     $(:(const libhdf5_hl = $libhdf5_hl))
 41     $(:(const libhdf5_size = $libhdf5_size))
 42     """
 43 end

I do not know how fix this and I’d like to be able to upgrade my module. I have tried to delete the .julia folder and rebuild everything, but this did not solve the problem. I am using a system provided MPI-enabled HDF5 library.

I discovered that my crash is related to MPI not loaded before the build command is triggered. If I load MPI before, everything works fine.