bugfix: don't fail if checking for "real" compiler version

doesn't understand a custom, user-defined compiler version.  However, if
the compiler's version check fails, you can't build anything with the
custom compiler.

- [x] Be more lenient: fall back to the custom compiler version and use
  it verbatim if the version check fails.
This commit is contained in:
Todd Gamblin 2019-12-13 17:31:37 -08:00
parent 4eb54b6358
commit 52ebc19b4e

View file

@ -69,6 +69,7 @@
import spack.compiler
import spack.paths
import spack.error as serr
import spack.util.executable
import spack.version
from spack.util.naming import mod_to_class
from spack.util.spack_yaml import syaml_dict
@ -214,7 +215,11 @@ def optimization_flags(self, compiler):
import spack.spec
if isinstance(compiler, spack.spec.CompilerSpec):
compiler = spack.compilers.compilers_for_spec(compiler).pop()
compiler_version = compiler.cc_version(compiler.cc)
try:
compiler_version = compiler.cc_version(compiler.cc)
except spack.util.executable.ProcessError as e:
# log this and just return compiler.version instead
tty.debug(str(e))
return self.microarchitecture.optimization_flags(
compiler.name, str(compiler_version)