diff options
author | Michał Górny <mgorny@quansight.com> | 2025-07-10 20:10:23 +0200 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2025-07-14 15:05:10 -0400 |
commit | 27c5ac36c841b047391fae9378684e06dcffea93 (patch) | |
tree | 54dc829dcc558604e9783881fa235e7a89727ee5 /docs/markdown/snippets | |
parent | 68f70840b35555f3f51e08f8595f23f4842b25e0 (diff) | |
download | meson-27c5ac36c841b047391fae9378684e06dcffea93.zip meson-27c5ac36c841b047391fae9378684e06dcffea93.tar.gz meson-27c5ac36c841b047391fae9378684e06dcffea93.tar.bz2 |
scalapack: Fix exception when MKLROOT is unset
Fix `scalapack.MKLPkgConfigDependency` not to crash when `MKLROOT`
is unset:
```
File "/meson/mesonbuild/dependencies/scalapack.py", line 65, in __init__
super().__init__(name, env, kwargs, language=language)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/meson/mesonbuild/dependencies/pkgconfig.py", line 322, in __init__
self._set_cargs()
~~~~~~~~~~~~~~~^^
File "/meson/mesonbuild/dependencies/scalapack.py", line 141, in _set_cargs
cflags = self.pkgconfig.cflags(self.name, allow_system, define_variable=(('prefix', self.__mklroot.as_posix()),))
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'as_posix'
```
The code is crashing because the `_set_cargs()` method assumes that
`self.__mklroot` will always be set, presumably because it assumes
it will only be called only when `MKLPkgConfigDependency.__init__()`
finishes with `is_found = True`. However, both `_set_cargs()`
and `_set_libs()` are called during `PkgConfigDependency.__init__()`,
and therefore they will be called if pkg-config lookup succeeds even
without `MKL_ROOT` set.
To avoid the issue, check for `self.__mklroot is None` in both
functions, and raise a `DependencyException` — effectively causing
the pkg-config lookup to fail in a natural way.
Fixes #11172
Signed-off-by: Michał Górny <mgorny@quansight.com>
Diffstat (limited to 'docs/markdown/snippets')
0 files changed, 0 insertions, 0 deletions