diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-04-13 14:39:04 -0700 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-04-20 17:56:04 +0300 |
commit | e308f116cbaaf002551182adc2bd1284fafd89e5 (patch) | |
tree | f3016023128577152ae144ad58915f3bc4b97ea6 | |
parent | d116d94f92d68583e139c18a53d18ccbb397bfae (diff) | |
download | meson-e308f116cbaaf002551182adc2bd1284fafd89e5.zip meson-e308f116cbaaf002551182adc2bd1284fafd89e5.tar.gz meson-e308f116cbaaf002551182adc2bd1284fafd89e5.tar.bz2 |
dependencies/OpenMP: If the version returned is not supported fail gracefully
Currently if the version returned is not a supported version, then you
get a lovely stack trace. This is not nice. This can be triggered easily
by adding gcc's `-fdirectives-only` flag, which stops the preprocessor
from doing certain macro expansions, including those used to detect
OpenMP.
Fixes #8652
-rw-r--r-- | mesonbuild/dependencies/misc.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 46f2337..5bf2f46 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -91,7 +91,13 @@ class OpenMPDependency(ExternalDependency): openmp_date = None if openmp_date: - self.version = self.VERSIONS[openmp_date] + try: + self.version = self.VERSIONS[openmp_date] + except KeyError: + mlog.debug(f'Could not find an OpenMP version matching {openmp_date}') + if openmp_date == '_OPENMP': + mlog.debug('This can be caused by flags such as gcc\'s `-fdirectives-only`, which affect preprocessor behavior.') + return # Flang has omp_lib.h header_names = ('omp.h', 'omp_lib.h') for name in header_names: |