Skip to content

Compiler flags in spec requirements regression #39671

@scheibelp

Description

@scheibelp

Steps to reproduce

Create the following environment:

spack:
  specs:
  - zlib
  view: false
  concretizer:
    unify: true
  packages:
    zlib:
      require: cflags="-g"

with this environment active, spack concretize fails.

This is on d9d1eb2

I can also reproduce it on 9bb5cff but not 87d4bda. So I'm guessing this logic needs to be updated with a better understanding of #38447.

What I find strange is that we have a test for this: test_require_cflags, which uses nearly exactly this config and passes (on all mentioned commits).

Error message

$ spack -d concretize -f
...
==> [2023-08-28-18:03:55.024834] UnsatisfiableSpecError: concretization failed for the following reasons:

   1. cannot satisfy a requirement for package 'zlib'.
==> [2023-08-28-18:03:55.024946] Error: concretization failed for the following reasons:

   1. cannot satisfy a requirement for package 'zlib'.
Traceback (most recent call last):
  File "/g/g17/scheibel/repos/spack-requireflags/spack/lib/spack/spack/main.py", line 1023, in main
    return _main(argv)
  File "/g/g17/scheibel/repos/spack-requireflags/spack/lib/spack/spack/main.py", line 978, in _main
    return finish_parse_and_run(parser, cmd_name, env_format_error)
  File "/g/g17/scheibel/repos/spack-requireflags/spack/lib/spack/spack/main.py", line 1006, in finish_parse_and_run
    return _invoke_command(command, parser, args, unknown)
  File "/g/g17/scheibel/repos/spack-requireflags/spack/lib/spack/spack/main.py", line 647, in _invoke_command
    return_val = command(parser, args)
  File "/g/g17/scheibel/repos/spack-requireflags/spack/lib/spack/spack/cmd/concretize.py", line 44, in concretize
    concretized_specs = env.concretize(force=args.force, tests=tests)
  File "/g/g17/scheibel/repos/spack-requireflags/spack/lib/spack/spack/environment/environment.py", line 1333, in concretize
    return self._concretize_together(tests=tests)
  File "/g/g17/scheibel/repos/spack-requireflags/spack/lib/spack/spack/environment/environment.py", line 1428, in _concretize_together
    concrete_specs: List[spack.spec.Spec] = spack.concretize.concretize_specs_together(
  File "/g/g17/scheibel/repos/spack-requireflags/spack/lib/spack/spack/concretize.py", line 741, in concretize_specs_together
    return _concretize_specs_together_new(*abstract_specs, **kwargs)
  File "/g/g17/scheibel/repos/spack-requireflags/spack/lib/spack/spack/concretize.py", line 748, in _concretize_specs_together_new
    result = solver.solve(abstract_specs, tests=kwargs.get("tests", False))
  File "/g/g17/scheibel/repos/spack-requireflags/spack/lib/spack/spack/solver/asp.py", line 2944, in solve
    result, _, _ = self.driver.solve(setup, specs, reuse=reusable_specs, output=output)
  File "/g/g17/scheibel/repos/spack-requireflags/spack/lib/spack/spack/solver/asp.py", line 864, in solve
    error_handler.raise_if_errors()
  File "/g/g17/scheibel/repos/spack-requireflags/spack/lib/spack/spack/solver/asp.py", line 683, in raise_if_errors
    raise UnsatisfiableSpecError(msg)
spack.solver.asp.UnsatisfiableSpecError: concretization failed for the following reasons:

   1. cannot satisfy a requirement for package 'zlib'.

Information on your system

I can reproduce this on Linux and Mac, e.g.

$ spack debug report
* **Spack:** 0.21.0.dev0 (d9d1eb24f9e1ef3550256ca16d5b0c567c3102c7)
* **Python:** 3.9.12
* **Platform:** linux-rhel8-broadwell
* **Concretizer:** clingo

General 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

Labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions