Skip to content

Specifying the compiler in a depends_on directive sets the compiler only on that node #20127

@alalazo

Description

@alalazo

Having a compiler set in a depends_on directive enforces that compiler by default only on that node, while the preferred compiler is used for other nodes.

Steps to reproduce the issue

Modify hdf5 with this diff:

--- a/var/spack/repos/builtin/packages/hdf5/package.py
+++ b/var/spack/repos/builtin/packages/hdf5/package.py
@@ -83,7 +83,7 @@ class Hdf5(AutotoolsPackage):
     if sys.platform != 'darwin':
         depends_on('numactl', when='+mpi+fortran')
     depends_on('szip', when='+szip')
-    depends_on('[email protected]:')
+    depends_on('[email protected]: %[email protected]')
 
     # There are several officially unsupported combinations of the features:
     # 1. Thread safety is not guaranteed via high-level C-API but in some cases

then try the following:

$ spack compiler list
==> Available compilers
-- clang ubuntu18.04-x86_64 -------------------------------------
[email protected]  [email protected]  [email protected]  [email protected]  [email protected]  [email protected]  [email protected]

-- gcc ubuntu18.04-x86_64 ---------------------------------------
[email protected]  [email protected]  [email protected]  [email protected]  [email protected]  [email protected]  [email protected]

$ spack solve hdf5~mpi
==> Best of 0 answers.
==> Optimization: [0, 2, -11, 0, 0, 0, -3, 1, 0, 1, -1, 0]
[email protected]%[email protected]~cxx~debug~fortran~hl~java~mpi+pic+shared~szip~threadsafe api=v18 arch=linux-ubuntu18.04-x86_64
    ^[email protected]%[email protected]+optimize+pic+shared arch=linux-ubuntu18.04-x86_64

Error Message

No error message, but one would expect to see by default:

$ spack solve hdf5~mpi
==> Best of 0 answers.
==> Optimization: [0, 2, -11, 0, 0, 0, -3, 1, 0, 1, -1, 0]
[email protected]%[email protected]~cxx~debug~fortran~hl~java~mpi+pic+shared~szip~threadsafe api=v18 arch=linux-ubuntu18.04-x86_64
    ^[email protected]%[email protected]+optimize+pic+shared arch=linux-ubuntu18.04-x86_64

Information on your system

  • Spack: 0.16.0-70-44665cb4e6
  • Python: 3.8.6
  • Platform: linux-ubuntu18.04-broadwell
  • Concretizer: clingo

Additional information

It may seem silly to enforce a compiler in a depends_on directive, but this is what happens under the hood when a spec containing a compiler specification is concretized together with others in an environment. For instance:

spack:
  view: false
  concretization: together
  config:
    concretizer: clingo
  specs:
  - hdf5%[email protected] ^zlib

behaves differently if concretization: separately is used.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions