Skip to content

solver: error with flags when a package appears multiple times in the DAG #51209

@alalazo

Description

@alalazo

Steps to reproduce

Assume you have some gcc compiler registered:

$ spack compiler list
==> Available compilers
-- gcc ubuntu20.04-x86_64 ---------------------------------------
[e]  [email protected]  [e]  [email protected]  [e]  [email protected]  [e]  [email protected]

and that gcc is your default compiler. Try to build a version of gcc not in the list with flags:

$ spack -m spec gcc@14 
 -   [email protected] build_system=generic languages:='c,c++,fortran' arch=linux-ubuntu20.04-icelake %c,[email protected]
 -       ^[email protected] build_system=generic arch=linux-ubuntu20.04-icelake 
[e]      ^[email protected] build_system=generic languages:='c,c++,fortran' arch=linux-ubuntu20.04-icelake 
 -       ^[email protected] build_system=generic arch=linux-ubuntu20.04-icelake 
[e]      ^[email protected] build_system=autotools arch=linux-ubuntu20.04-icelake 
$ spack -m spec gcc@14 cflags="-O3"
==> Error: set() does not equal {'-O3'}

Error message

$ spack -m spec gcc@14 cflags="-O3"
==> Error: set() does not equal {'-O3'}

The error is due to

cmd_specs = {s.name: s for spec in self._command_line_specs for s in spec.traverse()}

which assumes there's only one gcc in the spec, and errors out when looking at the compiler of gcc@14.

Information on your system

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

Assignees

Labels

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions