Repository: spack/spack

Issue:
quantum-espresso concretizes other providers than intel-oneapi-mkl for scalapack unless +cluster spec is used
### Steps to reproduce

I am building quantum espresso from the recipe in the following environment

```
spack:
  specs:
    - gcc
    - openmpi
    - intel-oneapi-mkl
    - quantum-espresso+mpi+openmp+scalapack
  packages:
    all:
      providers:
        scalapack: [intel-oneapi-mkl]
        fftw-api: [intel-oneapi-mkl]
        blas: [intel-oneapi-mkl]
        lapack: [intel-oneapi-mkl]
```
The concretization provides netlib-scalapack for scalapack in addition to intel-oneapi-mkl

```
==> Concretized quantum-espresso+mpi+openmp+scalapack
 -   h3jleui  quantum-espresso@7.3%gcc@11.3.0~clock~elpa+epw~fox~gipaw~ipo~libxc+mpi~nvtx+openmp+patch~qmcpack+scalapack build_system=cmake build_type=Release generator=make hdf5=none arch=linux-rhel8-icelake
[e]  zqrzfhm      ^cmake@3.24.3%gcc@11.3.0~doc+ncurses+ownlibs build_system=generic build_type=Release arch=linux-rhel8-icelake
[+]  wsggess      ^gcc-runtime@11.3.0%gcc@11.3.0 build_system=generic arch=linux-rhel8-icelake
[e]  q2dq5wn      ^git@2.39.3%gcc@11.3.0+man+nls+perl+subtree~svn~tcltk build_system=autotools arch=linux-rhel8-icelake
[+]  s72s4fm      ^gmake@4.4.1%gcc@11.3.0~guile build_system=generic arch=linux-rhel8-icelake
 -   dp7t2wp      ^intel-oneapi-mkl@2024.0.0%gcc@11.3.0~cluster+envmods~ilp64+shared build_system=generic mpi_family=none threads=none arch=linux-rhel8-icelake
 -   gpqoj4f          ^intel-tbb@2021.9.0%gcc@11.3.0~ipo+shared+tm build_system=cmake build_type=Release cxxstd=default generator=make patches=91755c6 arch=linux-rhel8-icelake
 -   t6o4ilu      ^m4@1.4.19%gcc@11.3.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-rhel8-icelake
 -   omnvp44          ^diffutils@3.9%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
[+]  cddzlag              ^libiconv@1.17%gcc@11.3.0 build_system=autotools libs=shared,static arch=linux-rhel8-icelake
[+]  cgsvgxd          ^libsigsegv@2.14%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
 -   qvacy3c      ^netlib-scalapack@2.2.0%gcc@11.3.0~ipo~pic+shared build_system=cmake build_type=Release generator=make patches=072b006,1c9ce5f,244a9aa arch=linux-rhel8-icelake
 -   b7faigv      ^openmpi@5.0.1%gcc@11.3.0~atomics~cuda~gpfs~internal-hwloc~internal-libevent~internal-pmix~java~legacylaunchers~lustre~memchecker~openshmem~orterunprefix~romio+rsh~static+vt+wrapper-rpath build_system=autotools fabrics=none patches=0a26bba schedulers=none arch=linux-rhel8-icelake
 -   bqvwq2c          ^autoconf@2.72%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
 -   ofgywno          ^automake@1.16.5%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
 -   75aj23a          ^hwloc@2.9.1%gcc@11.3.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-rhel8-icelake
 -   nzs7exa              ^libpciaccess@0.17%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
[+]  qlatgkr                  ^util-macros@1.19.3%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
 -   rwrycic              ^libxml2@2.10.3%gcc@11.3.0+pic~python+shared build_system=autotools arch=linux-rhel8-icelake
[+]  x5yidss                  ^xz@5.4.1%gcc@11.3.0~pic build_system=autotools libs=shared,static arch=linux-rhel8-icelake
 -   5cw7dl2              ^ncurses@6.4%gcc@11.3.0~symlinks+termlib abi=none build_system=autotools arch=linux-rhel8-icelake
 -   vysezdf          ^libevent@2.1.12%gcc@11.3.0+openssl build_system=autotools arch=linux-rhel8-icelake
 -   v57vbtd              ^openssl@3.1.3%gcc@11.3.0~docs+shared build_system=generic certs=mozilla arch=linux-rhel8-icelake
[+]  bltjbtl                  ^ca-certificates-mozilla@2023-05-30%gcc@11.3.0 build_system=generic arch=linux-rhel8-icelake
 -   ayzodvv          ^libtool@2.4.7%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
 -   mnirdaj              ^findutils@4.9.0%gcc@11.3.0 build_system=autotools patches=440b954 arch=linux-rhel8-icelake
 -   q5eddrt          ^numactl@2.0.14%gcc@11.3.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-rhel8-icelake
 -   qp4yrmq          ^openssh@9.5p1%gcc@11.3.0+gssapi build_system=autotools arch=linux-rhel8-icelake
 -   2or5l2v              ^krb5@1.20.1%gcc@11.3.0+shared build_system=autotools arch=linux-rhel8-icelake
 -   omiyvcz                  ^bison@3.8.2%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
 -   tg4iboh                  ^gettext@0.22.4%gcc@11.3.0+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools arch=linux-rhel8-icelake
 -   ttgls5n                      ^tar@1.34%gcc@11.3.0 build_system=autotools zip=pigz arch=linux-rhel8-icelake
 -   aaffaed                          ^pigz@2.7%gcc@11.3.0 build_system=makefile arch=linux-rhel8-icelake
[+]  7eivpw3                          ^zstd@1.5.5%gcc@11.3.0+programs build_system=makefile compression=none libs=shared,static arch=linux-rhel8-icelake
 -   ceo4kxj              ^libedit@3.1-20210216%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
 -   22fo6ja              ^libxcrypt@4.4.35%gcc@11.3.0~obsolete_api build_system=autotools patches=4885da3 arch=linux-rhel8-icelake
 -   fgtt5zr          ^perl@5.38.0%gcc@11.3.0+cpanm+opcode+open+shared+threads build_system=generic patches=714e4d1 arch=linux-rhel8-icelake
[+]  g6yyr7b              ^berkeley-db@18.1.40%gcc@11.3.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-rhel8-icelake
 -   rnuk5uy              ^bzip2@1.0.8%gcc@11.3.0~debug~pic+shared build_system=generic arch=linux-rhel8-icelake
 -   anf4mfi              ^gdbm@1.23%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
 -   otyi35c                  ^readline@8.2%gcc@11.3.0 build_system=autotools patches=bbf97f1 arch=linux-rhel8-icelake
[+]  w4df7jn          ^pkgconf@1.9.5%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
 -   znkvl5v          ^pmix@5.0.1%gcc@11.3.0~docs+pmi_backwards_compatibility~python~restful build_system=autotools arch=linux-rhel8-icelake
 -   xxzz3we          ^zlib-ng@2.1.5%gcc@11.3.0+compat+opt build_system=autotools arch=linux-rhel8-icelake
```
This does not happen if `+cluster `variant is used. 

```
==> Concretized quantum-espresso+mpi+openmp+scalapack
 -   4jkgdos  quantum-espresso@7.3%gcc@11.3.0~clock~elpa+epw~fox~gipaw~ipo~libxc+mpi~nvtx+openmp+patch~qmcpack+scalapack build_system=cmake build_type=Release generator=make hdf5=none arch=linux-rhel8-icelake
[e]  zqrzfhm      ^cmake@3.24.3%gcc@11.3.0~doc+ncurses+ownlibs build_system=generic build_type=Release arch=linux-rhel8-icelake
[+]  wsggess      ^gcc-runtime@11.3.0%gcc@11.3.0 build_system=generic arch=linux-rhel8-icelake
[e]  q2dq5wn      ^git@2.39.3%gcc@11.3.0+man+nls+perl+subtree~svn~tcltk build_system=autotools arch=linux-rhel8-icelake
[+]  s72s4fm      ^gmake@4.4.1%gcc@11.3.0~guile build_system=generic arch=linux-rhel8-icelake
 -   lups4gn      ^intel-oneapi-mkl@2024.0.0%gcc@11.3.0+cluster+envmods~ilp64+shared build_system=generic mpi_family=none threads=none arch=linux-rhel8-icelake
 -   gpqoj4f          ^intel-tbb@2021.9.0%gcc@11.3.0~ipo+shared+tm build_system=cmake build_type=Release cxxstd=default generator=make patches=91755c6 arch=linux-rhel8-icelake
 -   t6o4ilu      ^m4@1.4.19%gcc@11.3.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-rhel8-icelake
 -   omnvp44          ^diffutils@3.9%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
[+]  cddzlag              ^libiconv@1.17%gcc@11.3.0 build_system=autotools libs=shared,static arch=linux-rhel8-icelake
[+]  cgsvgxd          ^libsigsegv@2.14%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
 -   b7faigv      ^openmpi@5.0.1%gcc@11.3.0~atomics~cuda~gpfs~internal-hwloc~internal-libevent~internal-pmix~java~legacylaunchers~lustre~memchecker~openshmem~orterunprefix~romio+rsh~static+vt+wrapper-rpath build_system=autotools fabrics=none patches=0a26bba schedulers=none arch=linux-rhel8-icelake
 -   bqvwq2c          ^autoconf@2.72%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
 -   ofgywno          ^automake@1.16.5%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
 -   75aj23a          ^hwloc@2.9.1%gcc@11.3.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-rhel8-icelake
 -   nzs7exa              ^libpciaccess@0.17%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
[+]  qlatgkr                  ^util-macros@1.19.3%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
 -   rwrycic              ^libxml2@2.10.3%gcc@11.3.0+pic~python+shared build_system=autotools arch=linux-rhel8-icelake
[+]  x5yidss                  ^xz@5.4.1%gcc@11.3.0~pic build_system=autotools libs=shared,static arch=linux-rhel8-icelake
 -   5cw7dl2              ^ncurses@6.4%gcc@11.3.0~symlinks+termlib abi=none build_system=autotools arch=linux-rhel8-icelake
 -   vysezdf          ^libevent@2.1.12%gcc@11.3.0+openssl build_system=autotools arch=linux-rhel8-icelake
 -   v57vbtd              ^openssl@3.1.3%gcc@11.3.0~docs+shared build_system=generic certs=mozilla arch=linux-rhel8-icelake
[+]  bltjbtl                  ^ca-certificates-mozilla@2023-05-30%gcc@11.3.0 build_system=generic arch=linux-rhel8-icelake
 -   ayzodvv          ^libtool@2.4.7%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
 -   mnirdaj              ^findutils@4.9.0%gcc@11.3.0 build_system=autotools patches=440b954 arch=linux-rhel8-icelake
 -   q5eddrt          ^numactl@2.0.14%gcc@11.3.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-rhel8-icelake
 -   qp4yrmq          ^openssh@9.5p1%gcc@11.3.0+gssapi build_system=autotools arch=linux-rhel8-icelake
 -   2or5l2v              ^krb5@1.20.1%gcc@11.3.0+shared build_system=autotools arch=linux-rhel8-icelake
 -   omiyvcz                  ^bison@3.8.2%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
 -   tg4iboh                  ^gettext@0.22.4%gcc@11.3.0+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools arch=linux-rhel8-icelake
 -   ttgls5n                      ^tar@1.34%gcc@11.3.0 build_system=autotools zip=pigz arch=linux-rhel8-icelake
 -   aaffaed                          ^pigz@2.7%gcc@11.3.0 build_system=makefile arch=linux-rhel8-icelake
[+]  7eivpw3                          ^zstd@1.5.5%gcc@11.3.0+programs build_system=makefile compression=none libs=shared,static arch=linux-rhel8-icelake
 -   ceo4kxj              ^libedit@3.1-20210216%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
 -   22fo6ja              ^libxcrypt@4.4.35%gcc@11.3.0~obsolete_api build_system=autotools patches=4885da3 arch=linux-rhel8-icelake
 -   fgtt5zr          ^perl@5.38.0%gcc@11.3.0+cpanm+opcode+open+shared+threads build_system=generic patches=714e4d1 arch=linux-rhel8-icelake
[+]  g6yyr7b              ^berkeley-db@18.1.40%gcc@11.3.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-rhel8-icelake
 -   rnuk5uy              ^bzip2@1.0.8%gcc@11.3.0~debug~pic+shared build_system=generic arch=linux-rhel8-icelake
 -   anf4mfi              ^gdbm@1.23%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
 -   otyi35c                  ^readline@8.2%gcc@11.3.0 build_system=autotools patches=bbf97f1 arch=linux-rhel8-icelake
[+]  w4df7jn          ^pkgconf@1.9.5%gcc@11.3.0 build_system=autotools arch=linux-rhel8-icelake
 -   znkvl5v          ^pmix@5.0.1%gcc@11.3.0~docs+pmi_backwards_compatibility~python~restful build_system=autotools arch=linux-rhel8-icelake
 -   xxzz3we          ^zlib-ng@2.1.5%gcc@11.3.0+compat+opt build_system=autotools arch=linux-rhel8-icelake
```
Manual build of QuantumESPRESSO with `intel-oneapi-mkl` (without +cluster) installed via Spack find indeed scalapack in the package.
Are scalapack not available from the intel-oneapi-mkl package without +cluster spec?

### Error message

_No response_

### Information on your system

* **Spack:** 0.22.0.dev0 (91ff20cf7adc0ddf63d8e1df7b30e7598db9e322)
* **Python:** 3.6.8
* **Platform:** linux-rhel8-icelake
* **Concretizer:** clingo


### 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


Discussion:
> Are scalapack not available from the intel-oneapi-mkl package without +cluster spec?

That is true:
https://github.com/spack/spack/blob/66813460c0777a4a2bbeb071db3cd7318f382811/var/spack/repos/builtin/packages/intel-oneapi-mkl/package.py#L133

but maybe @rscohn2 can comment more on why.
The scalapack library is always installed and an application can add -lmkl_scalapack to its link line

+cluster controls whether the package provides libmkl_scalapack in its libs properties and related issues. That is useful if the application does not want to hard code the library names in its makefile/cmake
I think there is something funny going on with the concretization of quantum-espresso with `intel-oneapi-mkl` even when `+cluster` is added. I am using the upstream Spack and no matter what I do. I always end up with the `^netlib-scalapack` and `^intel-oneapi-mkl`.

Just give the following a try:
```
spack spec quantum-espresso ^[virtuals=blas] intel-oneapi-mkl+cluster threads=openmp ^[virtuals=scalapack] intel-oneapi-mkl+cluster threads=openmp
```

```
Input spec
--------------------------------
 -   quantum-espresso
 -       ^intel-oneapi-mkl+cluster threads=openmp

Concretized
--------------------------------
 -   quantum-espresso@7.3%gcc@11.4.0~clock~elpa+epw~fox~gipaw~ipo~libxc+mpi~nvtx+openmp+patch~qmcpack+scalapack build_system=cmake build_type=Release generator=make hdf5=none arch=linux-ubuntu22.04-icelake
[+]      ^cmake@3.27.4%gcc@11.4.0~doc+ncurses+ownlibs build_system=generic build_type=Release arch=linux-ubuntu22.04-icelake
[+]          ^curl@8.1.2%gcc@11.4.0~gssapi~ldap~libidn2~librtmp~libssh~libssh2+nghttp2 build_system=autotools libs=shared,static tls=openssl arch=linux-ubuntu22.04-icelake
[+]              ^nghttp2@1.52.0%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-icelake
[+]          ^ncurses@6.4%gcc@11.4.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-icelake
[+]          ^zlib-ng@2.1.3%gcc@11.4.0+compat+opt build_system=autotools patches=299b958,ae9077a,b692621 arch=linux-ubuntu22.04-icelake
[+]      ^gcc-runtime@11.4.0%gcc@11.4.0 build_system=generic arch=linux-ubuntu22.04-icelake
 -       ^git@2.42.0%gcc@11.4.0+man+nls+perl+subtree~svn~tcltk build_system=autotools arch=linux-ubuntu22.04-icelake
[+]          ^autoconf@2.69%gcc@11.4.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu22.04-icelake
[+]          ^automake@1.16.5%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-icelake
[+]          ^expat@2.5.0%gcc@11.4.0+libbsd build_system=autotools arch=linux-ubuntu22.04-icelake
[+]              ^libbsd@0.11.7%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-icelake
[+]                  ^libmd@1.0.4%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-icelake
[+]          ^gettext@0.21.1%gcc@11.4.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu22.04-icelake
[+]              ^bzip2@1.0.8%gcc@11.4.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-icelake
[+]              ^tar@1.34%gcc@11.4.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-icelake
[+]                  ^pigz@2.7%gcc@11.4.0 build_system=makefile arch=linux-ubuntu22.04-icelake
[+]                  ^zstd@1.5.5%gcc@11.4.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-icelake
[+]              ^xz@5.4.1%gcc@11.4.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-icelake
[+]          ^libiconv@1.17%gcc@11.4.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-icelake
 -           ^libidn2@2.3.4%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-icelake
 -               ^libunistring@1.1%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-icelake
[+]          ^libtool@2.4.7%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-icelake
 -           ^openssh@9.5p1%gcc@11.4.0+gssapi build_system=autotools arch=linux-ubuntu22.04-icelake
 -               ^krb5@1.20.1%gcc@11.4.0+shared build_system=autotools arch=linux-ubuntu22.04-icelake
[+]                  ^bison@3.8.2%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-icelake
[+]              ^libedit@3.1-20210216%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-icelake
[+]              ^libxcrypt@4.4.35%gcc@11.4.0~obsolete_api build_system=autotools patches=4885da3 arch=linux-ubuntu22.04-icelake
[+]          ^openssl@3.1.2%gcc@11.4.0~docs+shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-icelake
[+]              ^ca-certificates-mozilla@2023-05-30%gcc@11.4.0 build_system=generic arch=linux-ubuntu22.04-icelake
 -           ^pcre2@10.42%gcc@11.4.0~jit+multibyte build_system=autotools arch=linux-ubuntu22.04-icelake
[+]          ^perl@5.38.0%gcc@11.4.0+cpanm+opcode+open+shared+threads build_system=generic patches=714e4d1 arch=linux-ubuntu22.04-icelake
[+]              ^berkeley-db@18.1.40%gcc@11.4.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-icelake
[+]              ^gdbm@1.23%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-icelake
[+]                  ^readline@8.2%gcc@11.4.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-icelake
 -       ^gmake@4.4.1%gcc@11.4.0~guile build_system=generic arch=linux-ubuntu22.04-icelake
 -       ^intel-oneapi-mkl@2024.0.0%gcc@11.4.0+cluster+envmods~ilp64+shared build_system=generic mpi_family=none threads=openmp arch=linux-ubuntu22.04-icelake
 -           ^intel-tbb@2021.9.0%gcc@11.4.0~ipo+shared+tm build_system=cmake build_type=Release cxxstd=default generator=make patches=91755c6 arch=linux-ubuntu22.04-icelake
[+]      ^m4@1.4.19%gcc@11.4.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu22.04-icelake
[+]          ^diffutils@3.9%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-icelake
[+]          ^libsigsegv@2.14%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-icelake
[+]      ^mpich@4.1.2%gcc@11.4.0~argobots~cuda+fortran+hwloc+hydra+libxml2+pci~rocm+romio~slurm~vci~verbs+wrapperrpath build_system=autotools datatype-engine=auto device=ch4 netmod=ofi pmi=pmi arch=linux-ubuntu22.04-icelake
[+]          ^findutils@4.9.0%gcc@11.4.0 build_system=autotools patches=440b954 arch=linux-ubuntu22.04-icelake
[+]          ^hwloc@2.9.1%gcc@11.4.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu22.04-icelake
[+]          ^libfabric@1.19.0%gcc@11.4.0~debug~kdreg build_system=autotools fabrics=sockets,tcp,udp arch=linux-ubuntu22.04-icelake
[+]          ^libpciaccess@0.17%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-icelake
[+]              ^util-macros@1.19.3%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-icelake
[+]          ^libxml2@2.10.3%gcc@11.4.0+pic~python+shared build_system=autotools arch=linux-ubuntu22.04-icelake
[+]          ^pkgconf@1.9.5%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-icelake
[+]          ^yaksa@0.2%gcc@11.4.0~cuda~rocm build_system=autotools arch=linux-ubuntu22.04-icelake
[+]              ^python@3.11.4%gcc@11.4.0+bz2+crypt+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic patches=13fa8bf,b0615b2,f2fd060 arch=linux-ubuntu22.04-icelake
[+]                  ^libffi@3.4.4%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-icelake
[+]                  ^sqlite@3.42.0%gcc@11.4.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-ubuntu22.04-icelake
[+]                  ^util-linux-uuid@2.38.1%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-icelake
 -       ^netlib-scalapack@2.2.0%gcc@11.4.0~ipo~pic+shared build_system=cmake build_type=Release generator=make patches=072b006,1c9ce5f,244a9aa arch=linux-ubuntu22.04-icelake
 ```
I've bee reading the entire thread. Summary:
- The issue being reported is a non-issue (`intel-oneapi-mkl~cluster` does not provide scalapack for Spack, so another provider needs to be pulled in)
- The issue reported by @naromero77 is different, and seems related to the parser

@naromero77 The usual syntax to do what you want to do above is:
```console
$ spack spec quantum-espresso ^[virtuals=blas,scalapack] intel-oneapi-mkl+cluster threads=openmp
```
and seems to work for me. I need to double check why we allow multiple times the same name in the parser, and why we don't merge the second `virtuals=scalapack`. In fact if you invert your virtuals, you don't get `netlib-scalapack` in the DAG, but `openblas`.

Resolving patch:
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -1636,23 +1636,23 @@ def _add_dependency(self, spec: "Spec", *, depflag: dt.DepFlag, virtuals: Tuple[
             self.add_dependency_edge(spec, depflag=depflag, virtuals=virtuals)
             return
 
-        # Keep the intersection of constraints when a dependency is added
-        # multiple times. Currently, we only allow identical edge types.
+        # Keep the intersection of constraints when a dependency is added multiple times.
+        # The only restriction, currently, is keeping the same dependency type
         orig = self._dependencies[spec.name]
         try:
             dspec = next(dspec for dspec in orig if depflag == dspec.depflag)
         except StopIteration:
-            current_deps = ", ".join(
-                dt.flag_to_chars(x.depflag) + " " + x.spec.short_spec for x in orig
-            )
+            edge_attrs = f"deptypes={dt.flag_to_chars(depflag).strip()}"
+            required_dep_str = f"^[{edge_attrs}] {str(spec)}"
+
             raise DuplicateDependencyError(
-                f"{self.short_spec} cannot depend on '{spec.short_spec}' multiple times.\n"
-                f"\tRequired: {dt.flag_to_chars(depflag)}\n"
-                f"\tDependency: {current_deps}"
+                f"{spec.name} is a duplicate dependency, with conflicting dependency types\n"
+                f"\t'{str(self)}' cannot depend on '{required_dep_str}'"
             )
 
         try:
             dspec.spec.constrain(spec)
+            dspec.update_virtuals(virtuals=virtuals)
         except spack.error.UnsatisfiableSpecError:
             raise DuplicateDependencyError(
                 f"Cannot depend on incompatible specs '{dspec.spec}' and '{spec}'"


Test patch:
diff --git a/lib/spack/spack/test/spec_syntax.py b/lib/spack/spack/test/spec_syntax.py
--- a/lib/spack/spack/test/spec_syntax.py
+++ b/lib/spack/spack/test/spec_syntax.py
@@ -523,6 +523,23 @@ def _specfile_for(spec_str, filename):
             ],
             "^[virtuals=mpi] openmpi",
         ),
+        # Allow merging attributes, if deptypes match
+        (
+            "^[virtuals=mpi] openmpi+foo ^[virtuals=lapack] openmpi+bar",
+            [
+                Token(TokenType.START_EDGE_PROPERTIES, value="^["),
+                Token(TokenType.KEY_VALUE_PAIR, value="virtuals=mpi"),
+                Token(TokenType.END_EDGE_PROPERTIES, value="]"),
+                Token(TokenType.UNQUALIFIED_PACKAGE_NAME, value="openmpi"),
+                Token(TokenType.BOOL_VARIANT, value="+foo"),
+                Token(TokenType.START_EDGE_PROPERTIES, value="^["),
+                Token(TokenType.KEY_VALUE_PAIR, value="virtuals=lapack"),
+                Token(TokenType.END_EDGE_PROPERTIES, value="]"),
+                Token(TokenType.UNQUALIFIED_PACKAGE_NAME, value="openmpi"),
+                Token(TokenType.BOOL_VARIANT, value="+bar"),
+            ],
+            "^[virtuals=lapack,mpi] openmpi+bar+foo",
+        ),
         (
             "^[deptypes=link,build] zlib",
             [