summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/solver/concretize.lp19
-rw-r--r--lib/spack/spack/test/concretize.py11
2 files changed, 29 insertions, 1 deletions
diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp
index 02528e694d..a06d57ae10 100644
--- a/lib/spack/spack/solver/concretize.lp
+++ b/lib/spack/spack/solver/concretize.lp
@@ -44,6 +44,8 @@ node_flag_set(Package, Flag, Value) :- attr("node_flag_set", Package, Flag, Val
node_compiler_version_set(Package, Compiler, Version)
:- attr("node_compiler_version_set", Package, Compiler, Version).
+node_compiler_set(Package, Compiler)
+ :- attr("node_compiler_set", Package, Compiler).
variant_default_value_from_cli(Package, Variant, Value)
:- attr("variant_default_value_from_cli", Package, Variant, Value).
@@ -1011,6 +1013,12 @@ compiler_match(Package, Dependency)
compiler_mismatch(Package, Dependency)
:- depends_on(Package, Dependency),
+ not node_compiler_set(Dependency, _),
+ not compiler_match(Package, Dependency).
+
+compiler_mismatch_required(Package, Dependency)
+ :- depends_on(Package, Dependency),
+ node_compiler_set(Dependency, _),
not compiler_match(Package, Dependency).
#defined node_compiler_set/2.
@@ -1282,7 +1290,7 @@ opt_criterion(45, "preferred providers (non-roots)").
}.
% Try to minimize the number of compiler mismatches in the DAG.
-opt_criterion(40, "compiler mismatches").
+opt_criterion(40, "compiler mismatches that are not from CLI").
#minimize{ 0@240: #true }.
#minimize{ 0@40: #true }.
#minimize{
@@ -1291,6 +1299,15 @@ opt_criterion(40, "compiler mismatches").
build_priority(Package, Priority)
}.
+opt_criterion(39, "compiler mismatches that are not from CLI").
+#minimize{ 0@239: #true }.
+#minimize{ 0@39: #true }.
+#minimize{
+ 1@39+Priority,Package,Dependency
+ : compiler_mismatch_required(Package, Dependency),
+ build_priority(Package, Priority)
+}.
+
% Try to minimize the number of compiler mismatches in the DAG.
opt_criterion(35, "OS mismatches").
#minimize{ 0@235: #true }.
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index fd8baf8522..b943fad755 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -352,6 +352,17 @@ class TestConcretize(object):
assert set(spec.compiler_flags["cflags"]) == set(["-g"])
assert spec.satisfies("^openblas cflags='-O3'")
+ def test_mixing_compilers_only_affects_subdag(self):
+ spack.config.set("packages:all:compiler", ["clang", "gcc"])
+ spec = Spec("dt-diamond%gcc ^dt-diamond-bottom%clang").concretized()
+ for dep in spec.traverse():
+ assert ("%clang" in dep) == (dep.name == "dt-diamond-bottom")
+
+ def test_compiler_inherited_upwards(self):
+ spec = Spec("dt-diamond ^dt-diamond-bottom%clang").concretized()
+ for dep in spec.traverse():
+ assert "%clang" in dep
+
def test_architecture_inheritance(self):
"""test_architecture_inheritance is likely to fail with an
UnavailableCompilerVersionError if the architecture is concretized