Skip to content

Commit

Permalink
dependencies: hdf5: mark configtool dependency not-found for cmake build
Browse files Browse the repository at this point in the history
When hdf5 is built with cmake instead of autotools, it makes a number of
weird changes. What we care about in particular is that h5cc exists but
doesn't work -- it happily ignores -show and tries to compile stuff,
then leaves us with a dependency that has no libraries, and fails when
running `ninja`.

See: mesonbuild#12748
  • Loading branch information
eli-schwartz committed Feb 1, 2024
1 parent 55d30b6 commit f5da446
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mesonbuild/dependencies/hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,20 @@ def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.
# and then without -c to get the link arguments.
args = self.get_config_value(['-show', '-c'], 'args')[1:]
args += self.get_config_value(['-show', '-noshlib' if self.static else '-shlib'], 'args')[1:]
found = False
for arg in args:
if arg.startswith(('-I', '-f', '-D')) or arg == '-pthread':
self.compile_args.append(arg)
elif arg.startswith(('-L', '-l', '-Wl')):
self.link_args.append(arg)
found = True
elif Path(arg).is_file():
self.link_args.append(arg)
found = True

# cmake h5cc is broken
if not found:
raise DependencyException('HDF5 was built with cmake instead of autotools, and h5cc is broken.')

def _sanitize_version(self, ver: str) -> str:
v = re.search(r'\s*HDF5 Version: (\d+\.\d+\.\d+)', ver)
Expand Down

0 comments on commit f5da446

Please sign in to comment.