Skip to content

The ASP-based solver sometimes prefer to build a new version over using an external #22565

@alalazo

Description

@alalazo

This error has been reported by @bvanessen When using the ASP-based solver, sometimes, Spack prefers to build a new version of a package over using a declared external that match the requirements if buildable: true.

Steps to reproduce the issue

Using the following packages.yaml:

packages:
  python:
    externals:
    - spec: [email protected]+bz2+ctypes+dbm+lzma+nis+pyexpat+readline+sqlite3+ssl+tix+tkinter+uuid+zlib
      prefix: /usr/tce

and trying to concretize with Spack, one obtains:

$ spack -C . solve python
==> Best of 0 answers.
==> Optimization: [0, 0, 0, 0, 30, 0, 1, 0, 0, -20, 0]
[email protected]%[email protected]+bz2+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tix~tkinter~ucs4+uuid+zlib patches=0d98e93189bc278fbc37a50ed7f183bd8aaf249a8e1670a465f0db6bb4f8cf87 arch=linux-ubuntu18.04-broadwell
    ^[email protected]%[email protected]+shared arch=linux-ubuntu18.04-broadwell
        ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
            ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
    ^[email protected]%[email protected]+libbsd arch=linux-ubuntu18.04-broadwell
        ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
    ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
        ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
            ^[email protected]%[email protected]~symlinks+termlib arch=linux-ubuntu18.04-broadwell
                ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
    ^[email protected]%[email protected]+bzip2+curses+git~libunistring+libxml2+tar+xz arch=linux-ubuntu18.04-broadwell
        ^[email protected]%[email protected]~python arch=linux-ubuntu18.04-broadwell
            ^[email protected]%[email protected]~pic arch=linux-ubuntu18.04-broadwell
            ^[email protected]%[email protected]+optimize+pic+shared arch=linux-ubuntu18.04-broadwell
        ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell
    ^[email protected]%[email protected] patches=26f26c6f29a7ce9bf370ad3ab2610f99365b4bdd7b82e7c31df41a3370d685c0 arch=linux-ubuntu18.04-broadwell
    ^[email protected]%[email protected]~docs+systemcerts arch=linux-ubuntu18.04-broadwell
        ^[email protected]%[email protected]+cpanm+shared+threads arch=linux-ubuntu18.04-broadwell
            ^[email protected]%[email protected]~docs patches=b231fcc4d5cff05e5c3a4814f6a5af0e9a966428dc2176540d2c05aff41de522 arch=linux-ubuntu18.04-broadwell
    ^[email protected]%[email protected]+column_metadata+fts~functions~rtree arch=linux-ubuntu18.04-broadwell
    ^[email protected]%[email protected] arch=linux-ubuntu18.04-broadwell

Note that the preferred version weight is 0. For externals it is expected that version weights are negative, so they are preferred during minimization.

Error Message

There's no error message, and the solution is valid - but one would expect instead:

$ spack -C . solve python
==> Best of 0 answers.
==> Optimization: [-1, 3, 0, 0, 0, 0, 1, -1, 0, 0, 0]
[email protected]%[email protected]+bz2+ctypes+dbm~debug+libxml2+lzma+nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl+tix+tkinter~ucs4+uuid+zlib patches=c129e34472ee39b1083c38a49ad06a8573d8b3b208743a120ca4c0818cdf1801 arch=linux-ubuntu18.04-broadwell

Information on your system

  • Spack: 0.16.1-1896-0bed64503d
  • 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