spack compiler find: detect flang-new and flang in newer LLVM versions (#48914)

This commit is contained in:
Peter Scheibel 2025-02-10 22:34:28 -08:00 committed by GitHub
parent 025bc24996
commit dbd6857d32
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 58 additions and 4 deletions

View File

@ -16,6 +16,58 @@ paths:
c: ".*/bin/clang-3.9$"
cxx: ".*/bin/clang[+][+]-3.9$"
# flang-new detection: flang-new generates slightly-different output than clang
- layout:
- executables:
- "bin/clang"
- "bin/clang++"
script: |
echo "clang version 19.1.6 (https://github.com/spack/spack.git 8d3a733b7798b6e33c371518b6dec298c3ebd8b1)"
echo "Target: x86_64-unknown-linux-gnu"
echo "Thread model: posix"
echo "InstalledDir: /path/to/spack/install/llvm/bin"
- executables:
- "bin/flang-new"
script: |
echo "flang-new version 19.1.6 (https://github.com/spack/spack.git 8d3a733b7798b6e33c371518b6dec298c3ebd8b1)"
echo "Target: x86_64-unknown-linux-gnu"
echo "Thread model: posix"
echo "InstalledDir: /path/to/spack/install/llvm/bin"
platforms: ["darwin", "linux"]
results:
- spec: 'llvm@19.1.6 +flang+clang~lld~lldb'
extra_attributes:
compilers:
c: ".*/bin/clang"
cxx: ".*/bin/clang[+][+]"
fortran: ".*/bin/flang-new"
# flang: like previous test, but the fortran compiler is called "flang" vs. "flang-new"
- layout:
- executables:
- "bin/clang"
- "bin/clang++"
script: |
echo "clang version 20.1.0-rc1 (https://github.com/llvm/llvm-project af7f483a9d801252247b6c72e3763c1f55c5a506)"
echo "Target: x86_64-unknown-linux-gnu"
echo "Thread model: posix"
echo "InstalledDir: /tmp/clang/LLVM-20.1.0-rc1-Linux-X64/bin"
- executables:
- "bin/flang"
script: |
echo "flang version 20.1.0-rc1 (https://github.com/llvm/llvm-project af7f483a9d801252247b6c72e3763c1f55c5a506)"
echo "Target: x86_64-unknown-linux-gnu"
echo "Thread model: posix"
echo "InstalledDir: /tmp/clang/LLVM-20.1.0-rc1-Linux-X64/bin"
platforms: ["darwin", "linux"]
results:
- spec: 'llvm@20.1.0 +flang+clang~lld~lldb'
extra_attributes:
compilers:
c: ".*/bin/clang"
cxx: ".*/bin/clang[+][+]"
fortran: ".*/bin/flang"
# `~` and other weird characters in the version string
- layout:
- executables:

View File

@ -753,19 +753,21 @@ def patch(self):
string=True,
)
clang_and_friends = "(?:clang|flang|flang-new)"
compiler_version_regex = (
# Normal clang compiler versions are left as-is
r"clang version ([^ )\n]+)-svn[~.\w\d-]*|"
rf"{clang_and_friends} 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 ([^ )\n]+?)-[~.\w\d-]*|"
r"clang version ([^ )\n]+)|"
rf"{clang_and_friends} version ([^ )\n]+?)-[~.\w\d-]*|"
rf"{clang_and_friends} version ([^ )\n]+)|"
# LLDB
r"lldb version ([^ )\n]+)|"
# LLD
r"LLD ([^ )\n]+) \(compatible with GNU linkers\)"
)
fortran_names = ["flang"]
fortran_names = ["flang", "flang-new"]
@property
def supported_languages(self):