summaryrefslogtreecommitdiff
path: root/lib/spack/spack/compilers/arm.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/spack/spack/compilers/arm.py')
-rw-r--r--lib/spack/spack/compilers/arm.py39
1 files changed, 18 insertions, 21 deletions
diff --git a/lib/spack/spack/compilers/arm.py b/lib/spack/spack/compilers/arm.py
index 33801a1ccc..b2c4871236 100644
--- a/lib/spack/spack/compilers/arm.py
+++ b/lib/spack/spack/compilers/arm.py
@@ -3,10 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
-import re
-
-from spack.compiler import Compiler, _version_cache
-from spack.util.executable import Executable
+from spack.compiler import Compiler, get_compiler_version
class Arm(Compiler):
@@ -23,10 +20,10 @@ class Arm(Compiler):
fc_names = ['armflang']
# Named wrapper links within lib/spack/env
- link_paths = {'cc': 'clang/clang',
- 'cxx': 'clang/clang++',
- 'f77': 'clang/flang',
- 'fc': 'clang/flang'}
+ link_paths = {'cc': 'arm/armclang',
+ 'cxx': 'arm/armclang++',
+ 'f77': 'arm/armflang',
+ 'fc': 'arm/armflang'}
@property
def openmp_flag(self):
@@ -50,19 +47,19 @@ class Arm(Compiler):
@classmethod
def default_version(cls, comp):
- if comp not in _version_cache:
- compiler = Executable(comp)
- output = compiler('--version', output=str, error=str)
-
- ver = 'unknown'
- match = re.search(r'Arm C/C++/Fortran Compiler version ([^ )]+)',
- output)
- if match:
- ver = match.group(1)
-
- _version_cache[comp] = ver
-
- return _version_cache[comp]
+ """The ``--version`` option seems to be the most consistent one
+ for arm compilers. Output looks like this::
+
+ $ arm<c/f>lang --version
+ Arm C/C++/Fortran Compiler version 19.0 (build number 73) (based on LLVM 7.0.2) # NOQA
+ Target: aarch64--linux-gnu
+ Thread model: posix
+ InstalledDir:
+ /opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin # NOQA
+ """
+ return get_compiler_version(
+ comp, '--version',
+ r'Arm C\/C\+\+\/Fortran Compiler version ([^ )]+)')
@classmethod
def fc_version(cls, fc):