diff --git a/lib/spack/spack/compilers/clang.py b/lib/spack/spack/compilers/clang.py index 5eb08cbf0a..63aefdda72 100644 --- a/lib/spack/spack/compilers/clang.py +++ b/lib/spack/spack/compilers/clang.py @@ -159,11 +159,11 @@ def extract_version_from_output(cls, output): match = re.search( # Normal clang compiler versions are left as-is - r'clang version ([^ )]+)-svn[~.\w\d-]*|' + r'clang version ([^ )\n]+)-svn[~.\w\d-]*|' # Don't include hyphenated patch numbers in the version # (see https://github.com/spack/spack/pull/14365 for details) - r'clang version ([^ )]+?)-[~.\w\d-]*|' - r'clang version ([^ )]+)', + r'clang version ([^ )\n]+?)-[~.\w\d-]*|' + r'clang version ([^ )\n]+)', output ) if match: diff --git a/lib/spack/spack/test/compilers/detection.py b/lib/spack/spack/test/compilers/detection.py index 47e078f242..4652500b5d 100644 --- a/lib/spack/spack/test/compilers/detection.py +++ b/lib/spack/spack/test/compilers/detection.py @@ -96,7 +96,11 @@ def test_apple_clang_version_detection( ('clang version 8.0.0-3 (tags/RELEASE_800/final)\n' 'Target: aarch64-unknown-linux-gnu\n' 'Thread model: posix\n' - 'InstalledDir: /usr/bin\n', '8.0.0') + 'InstalledDir: /usr/bin\n', '8.0.0'), + ('clang version 11.0.0\n' + 'Target: aarch64-unknown-linux-gnu\n' + 'Thread model: posix\n' + 'InstalledDir: /usr/bin\n', '11.0.0') ]) def test_clang_version_detection(version_str, expected_version): version = spack.compilers.clang.Clang.extract_version_from_output( diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py index 84c2c88499..570ce32fb2 100644 --- a/var/spack/repos/builtin/packages/llvm/package.py +++ b/var/spack/repos/builtin/packages/llvm/package.py @@ -244,11 +244,11 @@ def filter_detected_exes(cls, prefix, exes_in_prefix): def determine_version(cls, exe): version_regex = re.compile( # Normal clang compiler versions are left as-is - r'clang version ([^ )]+)-svn[~.\w\d-]*|' + r'clang version ([^ )\n]+)-svn[~.\w\d-]*|' # Don't include hyphenated patch numbers in the version # (see https://github.com/spack/spack/pull/14365 for details) - r'clang version ([^ )]+?)-[~.\w\d-]*|' - r'clang version ([^ )]+)|' + r'clang version ([^ )\n]+?)-[~.\w\d-]*|' + r'clang version ([^ )\n]+)|' # LLDB r'lldb version ([^ )\n]+)|' # LLD