Skip to content

The ASP based solver prefers building a package over using externals if it has non-default variant values #22596

@alalazo

Description

@alalazo

This error has been reported by @bvanessen If an external package is declared with buildable: true and with non-default choices for variant values, Spack prefers to build a new package instead of using the external. What a user would expect instead is that the external is used whenever it is a viable choice.

Steps to reproduce the issue

Using this packages.yaml:

packages:
  openmpi:
    buildable: True
    externals:
    - spec: openmpi@4.1.0~cuda+cxx+cxx_exceptions~java~memchecker+pmi~sqlite3~static~thread_multiple~wrapper-rpath fabrics=psm schedulers=slurm
      prefix: /usr/tce/packages/openmpi/openmpi-4.1.0-gcc-8.3.1

and trying to concretize anything that depends on openmpi Spack tries to build a new version of the package:

$ spack -C . solve hdf5 ^openmpi
==> Best of 0 answers.
==> Optimization: [0, 0, 0, 0, 30, -2, 1, 0, 0, -29, 0]
hdf5@1.10.7%gcc@10.1.0~cxx~debug~fortran~hl~java+mpi+pic+shared~szip~threadsafe api=none arch=linux-ubuntu18.04-broadwell
    ^openmpi@4.0.5%gcc@10.1.0~atomics~cuda~cxx~cxx_exceptions+gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker~pmi~singularity~sqlite3+static~thread_multiple+vt+wrapper-rpath fabrics=none patches=60ce20bc14d98c572ef7883b9fcd254c3f232c2f3a13377480f96466169ac4c8 schedulers=none arch=linux-ubuntu18.04-broadwell
        ^hwloc@2.4.1%gcc@10.1.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml+pci+shared arch=linux-ubuntu18.04-broadwell
            ^libpciaccess@0.16%gcc@10.1.0 arch=linux-ubuntu18.04-broadwell
                ^libtool@2.4.6%gcc@10.1.0 arch=linux-ubuntu18.04-broadwell
                    ^m4@1.4.18%gcc@10.1.0+sigsegv patches=3877ab548f88597ab2327a2230ee048d2d07ace1062efe81fc92e91b7f39cd00,fc9b61654a3ba1a8d6cd78ce087e7c96366c290bc8d2c299f09828d793b853c8 arch=linux-ubuntu18.04-broadwell
                        ^libsigsegv@2.12%gcc@10.1.0 arch=linux-ubuntu18.04-broadwell
                ^pkgconf@1.7.3%gcc@10.1.0 arch=linux-ubuntu18.04-broadwell
                ^util-macros@1.19.1%gcc@10.1.0 arch=linux-ubuntu18.04-broadwell
            ^libxml2@2.9.10%gcc@10.1.0~python arch=linux-ubuntu18.04-broadwell
                ^libiconv@1.16%gcc@10.1.0 arch=linux-ubuntu18.04-broadwell
                ^xz@5.2.5%gcc@10.1.0~pic arch=linux-ubuntu18.04-broadwell
                ^zlib@1.2.11%gcc@10.1.0+optimize+pic+shared arch=linux-ubuntu18.04-broadwell
            ^ncurses@6.2%gcc@10.1.0~symlinks+termlib arch=linux-ubuntu18.04-broadwell
        ^libevent@2.1.12%gcc@10.1.0+openssl arch=linux-ubuntu18.04-broadwell
            ^openssl@1.1.1k%gcc@10.1.0~docs+systemcerts arch=linux-ubuntu18.04-broadwell
                ^perl@5.32.1%gcc@10.1.0+cpanm+shared+threads arch=linux-ubuntu18.04-broadwell
                    ^berkeley-db@18.1.40%gcc@10.1.0~docs patches=b231fcc4d5cff05e5c3a4814f6a5af0e9a966428dc2176540d2c05aff41de522 arch=linux-ubuntu18.04-broadwell
                    ^gdbm@1.19%gcc@10.1.0 arch=linux-ubuntu18.04-broadwell
                        ^readline@8.0%gcc@10.1.0 arch=linux-ubuntu18.04-broadwell
        ^numactl@2.0.14%gcc@10.1.0 patches=4e1d78cbbb85de625bad28705e748856033eaafab92a66dffd383a3d7e00cc94,62fc8a8bf7665a60e8f4c93ebbd535647cebf74198f7afafec4c085a8825c006 arch=linux-ubuntu18.04-broadwell
            ^autoconf@2.69%gcc@10.1.0 arch=linux-ubuntu18.04-broadwell
                ^help2man@1.47.16%gcc@10.1.0 arch=linux-ubuntu18.04-broadwell
                    ^gettext@0.21%gcc@10.1.0+bzip2+curses+git~libunistring+libxml2+tar+xz arch=linux-ubuntu18.04-broadwell
                        ^bzip2@1.0.8%gcc@10.1.0+shared arch=linux-ubuntu18.04-broadwell
                            ^diffutils@3.7%gcc@10.1.0 arch=linux-ubuntu18.04-broadwell
                        ^tar@1.32%gcc@10.1.0 arch=linux-ubuntu18.04-broadwell
            ^automake@1.16.3%gcc@10.1.0 arch=linux-ubuntu18.04-broadwell
        ^openssh@8.5p1%gcc@10.1.0 arch=linux-ubuntu18.04-broadwell
            ^libedit@3.1-20210216%gcc@10.1.0 arch=linux-ubuntu18.04-broadwell

Error Message

There's no error, but the optimal solution a user would expect is:

$ spack -C . solve hdf5 ^openmpi
==> Best of 0 answers.
==> Optimization: [0, 0, 0, 7, 0, -2, 1, 0, 0, -2, 0]
hdf5@1.10.7%gcc@10.1.0~cxx~debug~fortran~hl~java+mpi+pic+shared~szip~threadsafe api=none arch=linux-ubuntu18.04-broadwell
    ^openmpi@4.1.0%gcc@10.1.0~atomics~cuda+cxx+cxx_exceptions+gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker+pmi~singularity~sqlite3~static~thread_multiple+vt~wrapper-rpath fabrics=psm patches=60ce20bc14d98c572ef7883b9fcd254c3f232c2f3a13377480f96466169ac4c8 schedulers=slurm arch=linux-ubuntu18.04-broadwell
    ^zlib@1.2.11%gcc@10.1.0+optimize+pic+shared arch=linux-ubuntu18.04-broadwell

Information on your system

  • Spack: 0.16.1-1920-ddce89e4ce
  • Python: 3.6.9
  • Platform: linux-ubuntu18.04-broadwell
  • Concretizer: clingo

Additional information

  • 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

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions