spack icon indicating copy to clipboard operation
spack copied to clipboard

Spack v1.0: not choosing external package

Open harshula opened this issue 4 months ago • 13 comments

Steps to reproduce

The behaviour between Spack v0.22.5 and v1.0 appears to have changed in terms of external packages.

packages.yaml:

packages:
  cmake:
    externals:
    - spec: [email protected]
      prefix: /apps/cmake/3.24.2
    - spec: [email protected]
      prefix: /apps/cmake/3.31.6
    buildable: false
$ spack env activate -p access-test
$ spack concretize -f
==> Fetching https://ghcr.io/v2/spack/bootstrap-buildcache-v1/blobs/sha256:232504c082b9badb4b1c2540f36f2e0c28f8f314f742262935e82aef0c049a0c
==> Fetching https://ghcr.io/v2/spack/bootstrap-buildcache-v1/blobs/sha256:90b7cf4dd98e26c58578ad8604738cc32dfbb228cfb981bdfe103c99d0e7b5dd
==> Installing "clingo-bootstrap@=spack~docs+ipo+optimized+python+static_libstdcpp build_system=cmake build_type=Release generator=make patches:=bebb819,ec99431 arch=linux-centos7-x86_64" from a buildcache
==> Warning: The default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed and some mode bits are cleared. See https://access.redhat.com/articles/7004769 for more details.
==> Error: failed to concretize `[email protected]=2025.06.001` for the following reasons:
     1. cannot satisfy a requirement for package 'cmake'.

However, if I add:

$ git diff
diff --git a/spack.yaml b/spack.yaml
index cff8cfd..9e5e175 100644
--- a/spack.yaml
+++ b/spack.yaml
@@ -36,6 +36,9 @@ spack:
     gcc-runtime:
       require:
         - '%gcc'
+    cmake:
+      require:
+        - '@3.31.6'
     # When using multi-HPC builds, this spack.packages.all section can be commented out.
     all:
       require:
[access-test] $ spack concretize -f
==> Concretized 1 spec:
 -   tzsmekb  [email protected]=2025.06.001+mpi build_system=bundle commit=ad752e79c09641bf88a3eddf291a48a2c4f2c842 arch=linux-rocky8-x86_64 
 -   hh3me77      ^access-test-component@main~ipo+mpi build_system=cmake build_type=Release commit=a20fc23a548d3e712f4810f61d7c7501a494c022 generator=make arch=linux-rocky8-x86_64 %[email protected]
[e]  g7rjfeh          ^[email protected]~doc+ncurses+ownlibs~qtgui build_system=generic build_type=Release patches:=fdea723 arch=linux-rocky8-x86_64_v4 
 -   frteov3          ^[email protected] build_system=generic arch=linux-rocky8-x86_64 
[e]  2qfauaq          ^[email protected]~binutils+bootstrap~graphite~mold~nvptx~piclibs~profiled~strip build_system=autotools build_type=RelWithDebInfo languages:='c,c++,fortran' arch=linux-rocky8-x86_64 
 -   4udwuf4          ^[email protected] build_system=generic arch=linux-rocky8-x86_64 
[e]  vuczjrb          ^[email protected] build_system=autotools arch=linux-rocky8-x86_64 
 -   q3hqtxt          ^[email protected]~guile build_system=generic arch=linux-rocky8-x86_64 %[email protected]
[e]  hxuiquw              ^[email protected] build_system=generic arch=linux-rocky8-x86_64 
[e]  g5lm4ia          ^[email protected]+atomics~cuda~cxx~cxx_exceptions~debug+fortran~gpfs~internal-hwloc~internal-libevent~internal-pmix~ipv6~java~lustre~memchecker~openshmem~orterunprefix~rocm+romio+rsh~singularity~static~two_level_namespace+vt+wrapper-rpath build_system=autotools fabrics:=none romio-filesystem:=none schedulers:=none arch=linux-rocky8-x86_64 

Error message

$ spack --debug --stacktrace concretize -f
lib/spack/spack/cmd/__init__.py:125 ==> [2025-08-28-02:07:12.366603] Imported concretize from built-in commands
lib/spack/spack/cmd/__init__.py:125 ==> [2025-08-28-02:07:12.370023] Imported concretize from built-in commands
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:12.444456] Reading config from file /[...]/test-spack-v1.0-2/environments/access-test/spack.yaml
lib/spack/spack/environment/environment.py:249 ==> [2025-08-28-02:07:12.463439] Deactivated environment 'access-test'
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:12.500493] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/defaults/repos.yaml
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:12.509764] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/repos.yaml
lib/spack/spack/environment/environment.py:222 ==> [2025-08-28-02:07:12.525984] Using environment 'access-test'
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:12.526806] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/defaults/concretizer.yaml
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:12.545648] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/concretizer.yaml
lib/spack/spack/database.py:611 ==> [2025-08-28-02:07:12.637180] DATABASE LOCK TIMEOUT: 600s
lib/spack/spack/store.py:181 ==> [2025-08-28-02:07:12.637767] PACKAGE LOCK TIMEOUT: No timeout
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:12.640202] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/defaults/base/packages.yaml
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:12.700016] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/packages.yaml
lib/spack/spack/database.py:611 ==> [2025-08-28-02:07:18.690342] DATABASE LOCK TIMEOUT: 600s
lib/spack/spack/store.py:181 ==> [2025-08-28-02:07:18.690971] PACKAGE LOCK TIMEOUT: No timeout
lib/spack/spack/database.py:611 ==> [2025-08-28-02:07:18.700531] DATABASE LOCK TIMEOUT: 600s
lib/spack/spack/store.py:181 ==> [2025-08-28-02:07:18.701039] PACKAGE LOCK TIMEOUT: No timeout
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:18.983581] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/defaults/mirrors.yaml
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:19.210026] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/defaults/bootstrap.yaml
lib/spack/spack/environment/environment.py:249 ==> [2025-08-28-02:07:19.231552] Deactivated environment 'access-test'
lib/spack/spack/bootstrap/config.py:127 ==> [2025-08-28-02:07:19.235973] [BOOTSTRAP CONFIG SCOPE] name=_builtin
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:19.237190] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/defaults/bootstrap.yaml
lib/spack/spack/bootstrap/config.py:136 ==> [2025-08-28-02:07:19.246529] [BOOTSTRAP CONFIG SCOPE] name=defaults, path=/[...]/test-spack-v1.0-2/spack/etc/spack/defaults
lib/spack/spack/bootstrap/config.py:136 ==> [2025-08-28-02:07:19.246748] [BOOTSTRAP CONFIG SCOPE] name=bootstrap, path=/[...]/test-spack-v1.0-2/bootstrap/config
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:19.247630] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/defaults/include.yaml
lib/spack/spack/config.py:866 ==> [2025-08-28-02:07:19.251064] Creating DirectoryConfigScope defaults:linux for '/[...]/test-spack-v1.0-2/spack/etc/spack/defaults/linux'
lib/spack/spack/config.py:866 ==> [2025-08-28-02:07:19.251438] Creating DirectoryConfigScope defaults:base for '/[...]/test-spack-v1.0-2/spack/etc/spack/defaults/base'
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:19.254513] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/defaults/config.yaml
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:19.276427] Reading config from file /[...]/test-spack-v1.0-2/bootstrap/config/config.yaml
lib/spack/spack/database.py:611 ==> [2025-08-28-02:07:19.289056] DATABASE LOCK TIMEOUT: 600s
lib/spack/spack/store.py:181 ==> [2025-08-28-02:07:19.289315] PACKAGE LOCK TIMEOUT: No timeout
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:19.361651] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/defaults/base/packages.yaml
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:19.422745] Reading config from file /[...]/test-spack-v1.0-2/bootstrap/config/packages.yaml
lib/spack/spack/bootstrap/_common.py:239 ==> [2025-08-28-02:07:19.507705] [BOOTSTRAP ROOT SPEC] clingo-bootstrap@spack+python platform=linux target=x86_64
lib/spack/spack/bootstrap/core.py:358 ==> [2025-08-28-02:07:19.508300] [BOOTSTRAP MODULE clingo] Try importing from Python
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:19.510070] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/defaults/bootstrap.yaml
lib/spack/spack/bootstrap/_common.py:97 ==> [2025-08-28-02:07:19.563645] [BOOTSTRAP MODULE clingo] The installed spec "clingo-bootstrap@spack+python platform=linux target=x86_64 ^[email protected]/a4oyom2bc4go3floq7jlymc2l745w7vl" provides the "clingo" Python module
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:19.565069] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/defaults/config.yaml
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:19.587925] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/config.yaml
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:19.592952] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/defaults/repos.yaml
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:19.597120] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/repos.yaml
lib/spack/spack/environment/environment.py:222 ==> [2025-08-28-02:07:19.603350] Using environment 'access-test'
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:19.613826] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/defaults/base/packages.yaml
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:19.699002] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/packages.yaml
lib/spack/spack/solver/asp.py:3598 ==> [2025-08-28-02:07:20.113208] the spec [email protected]/5z3r7zdqd4qm7dghzbkjuip6zh4xvpiy does not provide a C compiler.
lib/spack/spack/solver/asp.py:3598 ==> [2025-08-28-02:07:20.120459] the spec [email protected]/ywm7olzdrnskvmlzuz7egldvsmd2ammq does not provide a C compiler.
lib/spack/spack/solver/asp.py:3598 ==> [2025-08-28-02:07:20.127049] the spec [email protected]/wdnpbv6kshw6vchypxbnlfhqghbt73q6 does not provide a C compiler.
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:20.795166] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/defaults/concretizer.yaml
lib/spack/spack/config.py:1189 ==> [2025-08-28-02:07:20.828195] Reading config from file /[...]/test-spack-v1.0-2/spack/etc/spack/concretizer.yaml
lib/spack/spack/solver/input_analysis.py:94 ==> [2025-08-28-02:07:21.227965] [spack.solver.input_analysis] msmpi is not for this platform
lib/spack/spack/solver/input_analysis.py:94 ==> [2025-08-28-02:07:22.417128] [spack.solver.input_analysis] apple-libuuid is not for this platform
lib/spack/spack/solver/input_analysis.py:94 ==> [2025-08-28-02:07:22.809900] [spack.solver.input_analysis] nvpl-blas is not for this platform
lib/spack/spack/solver/input_analysis.py:94 ==> [2025-08-28-02:07:22.903454] [spack.solver.input_analysis] veclibfort is not for this platform
lib/spack/spack/solver/input_analysis.py:94 ==> [2025-08-28-02:07:22.940576] [spack.solver.input_analysis] nvpl-lapack is not for this platform
lib/spack/spack/solver/input_analysis.py:94 ==> [2025-08-28-02:07:23.570064] [spack.solver.input_analysis] wgl is not for this platform
lib/spack/spack/solver/input_analysis.py:94 ==> [2025-08-28-02:07:23.576464] [spack.solver.input_analysis] apple-gl is not for this platform
lib/spack/spack/solver/input_analysis.py:94 ==> [2025-08-28-02:07:24.910138] [spack.solver.input_analysis] apple-libunwind is not for this platform
lib/spack/spack/solver/input_analysis.py:94 ==> [2025-08-28-02:07:26.165869] [spack.solver.input_analysis] apple-clang is not for this platform
lib/spack/spack/solver/input_analysis.py:94 ==> [2025-08-28-02:07:26.173517] [spack.solver.input_analysis] msvc is not for this platform
lib/spack/spack/solver/asp.py:2313 ==> [2025-08-28-02:07:29.341013] [spack.solver.asp]: not considering intel-oneapi-compilers-classic@=2021.13.1 as external, since it's a non-working compiler
lib/spack/spack/solver/asp.py:2313 ==> [2025-08-28-02:07:29.341401] [spack.solver.asp]: not considering intel-oneapi-compilers-classic@=2021.13.0 as external, since it's a non-working compiler
lib/spack/spack/solver/asp.py:2313 ==> [2025-08-28-02:07:29.341762] [spack.solver.asp]: not considering intel-oneapi-compilers-classic@=2021.11.1 as external, since it's a non-working compiler
lib/spack/spack/solver/requirements.py:230 ==> [2025-08-28-02:07:29.425482] [spack.solver.requirements] Rejecting '%[email protected]' for compiler package acfl
lib/spack/spack/solver/requirements.py:230 ==> [2025-08-28-02:07:29.499507] [spack.solver.requirements] Rejecting '%[email protected]' for compiler package aocc
lib/spack/spack/solver/requirements.py:230 ==> [2025-08-28-02:07:30.036021] [spack.solver.requirements] Rejecting '%[email protected]' for compiler package cce
lib/spack/spack/solver/requirements.py:230 ==> [2025-08-28-02:07:30.163977] [spack.solver.requirements] Rejecting '%[email protected]' for compiler package compiler-wrapper
lib/spack/spack/solver/requirements.py:230 ==> [2025-08-28-02:07:30.727787] [spack.solver.requirements] Rejecting '%[email protected]' for compiler package fj
lib/spack/spack/solver/requirements.py:230 ==> [2025-08-28-02:07:30.974241] [spack.solver.requirements] Rejecting '%[email protected]' for compiler package gcc
lib/spack/spack/solver/requirements.py:230 ==> [2025-08-28-02:07:31.359556] [spack.solver.requirements] Rejecting '%[email protected]' for compiler package glibc
lib/spack/spack/solver/requirements.py:230 ==> [2025-08-28-02:07:32.376099] [spack.solver.requirements] Rejecting '%[email protected]' for compiler package intel-oneapi-compilers
lib/spack/spack/solver/requirements.py:230 ==> [2025-08-28-02:07:32.390365] [spack.solver.requirements] Rejecting '%[email protected]' for compiler package intel-oneapi-compilers-classic
lib/spack/spack/solver/requirements.py:230 ==> [2025-08-28-02:07:32.439358] [spack.solver.requirements] Rejecting '%[email protected]' for compiler package intel-oneapi-runtime
lib/spack/spack/solver/requirements.py:230 ==> [2025-08-28-02:07:34.517293] [spack.solver.requirements] Rejecting '%[email protected]' for compiler package llvm
lib/spack/spack/solver/requirements.py:230 ==> [2025-08-28-02:07:34.552188] [spack.solver.requirements] Rejecting '%[email protected]' for compiler package llvm-amdgpu
lib/spack/spack/solver/requirements.py:230 ==> [2025-08-28-02:07:35.165367] [spack.solver.requirements] Rejecting '%[email protected]' for compiler package musl
lib/spack/spack/solver/requirements.py:230 ==> [2025-08-28-02:07:35.479983] [spack.solver.requirements] Rejecting '%[email protected]' for compiler package nag
lib/spack/spack/solver/requirements.py:230 ==> [2025-08-28-02:07:35.902033] [spack.solver.requirements] Rejecting '%[email protected]' for compiler package nvhpc
lib/spack/spack/solver/requirements.py:230 ==> [2025-08-28-02:07:39.997463] [spack.solver.requirements] Rejecting '%[email protected]' for compiler package xl
lib/spack/spack/main.py:1097 ==> [2025-08-28-02:08:03.227681] UnsatisfiableSpecError: failed to concretize `[email protected]=2025.06.001` for the following reasons:
     1. cannot satisfy a requirement for package 'cmake'.
lib/spack/spack/error.py:58 ==> [2025-08-28-02:08:03.543721] Error: failed to concretize `[email protected]=2025.06.001` for the following reasons:
     1. cannot satisfy a requirement for package 'cmake'.
Traceback (most recent call last):
  File "/[...]/test-spack-v1.0-2/spack/lib/spack/spack/main.py", line 1090, in main
    return _main(argv)
  File "/[...]/test-spack-v1.0-2/spack/lib/spack/spack/main.py", line 1042, in _main
    return finish_parse_and_run(parser, cmd_name, args, env_format_error)
  File "/[...]/test-spack-v1.0-2/spack/lib/spack/spack/main.py", line 1073, in finish_parse_and_run
    return _invoke_command(command, parser, args, unknown)
  File "/[...]/test-spack-v1.0-2/spack/lib/spack/spack/main.py", line 591, in _invoke_command
    return_val = command(parser, args)
  File "/[...]/test-spack-v1.0-2/spack/lib/spack/spack/cmd/concretize.py", line 44, in concretize
    concretized_specs = env.concretize(tests=tests)
  File "/[...]/test-spack-v1.0-2/spack/lib/spack/spack/environment/environment.py", line 1470, in concretize
    return self._concretize_together(tests=tests)
  File "/[...]/test-spack-v1.0-2/spack/lib/spack/spack/environment/environment.py", line 1576, in _concretize_together
    specs_to_concretize, tests=tests
  File "/[...]/test-spack-v1.0-2/spack/lib/spack/spack/concretize.py", line 54, in concretize_together
    concrete_specs = _concretize_specs_together(to_concretize, tests=tests)
  File "/[...]/test-spack-v1.0-2/spack/lib/spack/spack/concretize.py", line 37, in _concretize_specs_together
    result = Solver().solve(abstract_specs, tests=tests, allow_deprecated=allow_deprecated)
  File "/[...]/test-spack-v1.0-2/spack/lib/spack/spack/solver/asp.py", line 4899, in solve
    result, _, _ = self.solve_with_stats(specs, **kwargs)
  File "/[...]/test-spack-v1.0-2/spack/lib/spack/spack/solver/asp.py", line 4890, in solve_with_stats
    setup, specs, reuse=reusable_specs, output=output, allow_deprecated=allow_deprecated
  File "/[...]/test-spack-v1.0-2/spack/lib/spack/spack/solver/asp.py", line 1249, in solve
    error_handler.raise_if_errors()
  File "/[...]/test-spack-v1.0-2/spack/lib/spack/spack/solver/asp.py", line 1101, in raise_if_errors
    raise UnsatisfiableSpecError(msg)
spack.solver.asp.UnsatisfiableSpecError: failed to concretize `[email protected]=2025.06.001` for the following reasons:
     1. cannot satisfy a requirement for package 'cmake'.

Information on your system

  • Spack: 1.0.1 (https://github.com/spack/spack/commit/17d34285729c1bb39dfbdef09c5b78d88bb9e3f9)
  • Builtin repo: https://github.com/spack/spack-packages/commit/60517d15b003ddb01214ae1f949fc1180cb68049
  • Python: 3.6.8
  • Platform: linux-rocky8-cascadelake

General information

  • [x] I have run spack debug report and reported the version of Spack/Python/Platform
  • [x] I have searched the issues of this repo and believe this is not a duplicate
  • [x] I have run the failing commands in debug mode and reported the output

harshula avatar Aug 27 '25 16:08 harshula

Hi @alalazo & @scheibelp , Please let me know if you want more information.

harshula avatar Aug 27 '25 16:08 harshula

$ spack -V
0.22.5 (f348dd2bcbd64e8da8a375ab3cfa300e77aca352)

$ spack concretize -f
==> Concretized [email protected]=2025.06.001
 -   7rxvpdu  [email protected]=2025.06.001%[email protected]+mpi build_system=bundle arch=linux-rocky8-x86_64
 -   az3zpwk      ^access-test-component@main%[email protected]~ipo+mpi build_system=cmake build_type=Release generator=make arch=linux-rocky8-x86_64
[e]  fyk2q36          ^[email protected]%[email protected]~doc+ncurses+ownlibs build_system=generic build_type=Release arch=linux-rocky8-x86_64
 -   doeoclg          ^[email protected]%[email protected]~guile build_system=generic arch=linux-rocky8-x86_64
[e]  qg5spmh          ^[email protected]%[email protected]~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~internal-libevent~internal-pmix~java~legacylaunchers~lustre~memchecker~openshmem~orterunprefix~romio+rsh~singularity~static+vt+wrapper-rpath build_system=autotools fabrics=none romio-filesystem=none schedulers=none arch=linux-rocky8-x86_64
[e]  5elnsoi      ^[email protected]%[email protected] build_system=autotools arch=linux-rocky8-x86_64

harshula avatar Aug 27 '25 16:08 harshula

It's likely

     all:
       require:
 ...

can you share that bit?

haampie avatar Aug 27 '25 19:08 haampie

Hi @haampie , The same spack.yaml was used for both Spack v1.0 and v0.22.

harshula avatar Aug 28 '25 02:08 harshula

It's:

all:
  require:
  - '%[email protected]'

In Spack v1.0 compiler are modeled as dependencies, and externals don't have dependencies. This means the %intel requirement cannot be satisfied on CMake. We should improve the error message to point to the requirement that is not satisfied.

alalazo avatar Aug 28 '25 05:08 alalazo

Hi @alalazo , Thanks for looking into this. How should we use Spack v1.0 with externals (e.g. CMake w/ buildable: false) and require all buildable packages are built with %[email protected]?

harshula avatar Aug 28 '25 05:08 harshula

You can either require a unique provider for the languages you care about (in which case you need to use the correct package name):

packages:
    c:
     require:
     - intel-oneapi-compilers-classic
    cxx:
     require:
     - intel-oneapi-compilers-classic
    fortran:
     require:
     - intel-oneapi-compilers-classic

or define a toolchain and keep your current idiom of using % under all::

  toolchains:
    intel_toolchain:
    - spec: '%c=oneapi'
      when: '%c'
    - spec: '%cxx=oneapi'
      when: '%cxx'
    - spec: '%fortran=oneapi'
      when: '%fortran'

  packages:
    all:
      require:
      - "%intel_toolchain"

If you're using intel you also need to check that icc and icpc are available (if I understand correctly, 2024 versions of oneAPI only provide ifort)

alalazo avatar Aug 28 '25 06:08 alalazo

This should be documented in https://spack.readthedocs.io/en/latest/frequently_asked_questions.html.

See #51240.

haampie avatar Aug 28 '25 07:08 haampie

Hi @alalazo & @haampie , Is there a way to add the desired constraint (build all buildable packages with %[email protected]) to a spack.yaml file where it will be compatible with both Spack v0.22 and v1.0?

harshula avatar Aug 28 '25 08:08 harshula

No

haampie avatar Aug 28 '25 09:08 haampie

Hi @alalazo & @haampie ,

We going down the toolchains path and planning to deploy Spack v1.1.0. Does Spack 1.1+ treat Scenario A and B the same?

Scenario A:

spack:
  specs:
    - [email protected]=latest
...
    all:
      require:
        - '%access_intel'

Scenario B

spack:
  specs:
    - [email protected]=latest %%access_intel

harshula avatar Nov 24 '25 00:11 harshula

Does Spack 1.1+ treat Scenario A and B the same?

@harshula No. In Scenario A there is a strict requirement to depend on the access_intel toolchain for all the packages that do not have a specific require: section. This means that e.g. things like cmake and such will be required to build with that toolchain, if you don't specify otherwise explicitly.

In Scenario B the %% propagates a strong preference for access_intel in the runtime part of the access-om2 DAG. This means that:

  1. A conflict in a package directive on the compilers in access_intel, for a runtime node, will not cause an error but will be silently respected by the concretizer.
  2. You can have exception in the runtime DAG via require: on a specific node
  3. Build-only dependencies are not directly affected by the preference.

Point 3. allows you to use a separate prefer: for the language virtuals on other nodes e.g.

packages:
  prefer:
    c:
    - gcc

In that case gcc will be the preference for build only dependencies in the DAG.

alalazo avatar Nov 24 '25 07:11 alalazo

Hi @alalazo ,

We are close to finalising our changes for the Spack v0.22 to Spack v1.1 transition. This should be the final spack.yaml compiler syntax question. Does Spack 1.1+ treat Scenario A and B the same? Thanks!

Scenario A:

spack:
...
    intel-oneapi-compilers-classic:
      require:
        - '@2021.10.0'
    all:
      require:
        - '%access_intel'
        - 'target=x86_64'
toolchains:
  access_intel:
  - spec: '%c=intel-oneapi-compilers-classic'
    when: '%c'
  - spec: '%cxx=intel-oneapi-compilers-classic'
    when: '%cxx'
  - spec: '%fortran=intel-oneapi-compilers-classic'
    when: '%fortran'

Scenario B:

    c:
      require:
        - '[email protected]'
    cxx:
      require:
        - '[email protected]'
    fortran:
      require:
        - '[email protected]'
    all:
      require:
        - 'target=x86_64'

harshula avatar Dec 06 '25 04:12 harshula