spack / spack/spack

Modify `compilers.yaml` through through Spack CLI

Open
#39,072 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
Python
Stars
5.1k
Forks
2.5k
Avg merge
3d 4h
Merged PRs (30d)
82

Description

Summary

Modifying compilers.yaml manually and using spack compiler {find/add} [path] are both very effective in setting compiler configuration. I'd like a quick way add paths/flags/environment variables through the Spack CLI. Something like:

spack config add compilers:clang@16.0.6:flags:cflags:[-O3,-fPIC]

or

spack compiler set llvm@16.0.6 paths:f77:usr/bin/gfortran
Rationale

This feature request is related to a problem I have in CI/CD.

I have a tool that that tests compilers with different flags. Ideally, I'd like to run a script that goes along the lines of:

./run_compiler_test.sh

spack config add compilers:clang@16.0.6:flags:cflags:[-O1]
./run_compiler_test.sh

spack config add compilers:clang@16.0.6:flags:cflags:[-O2]
./run_compiler_test.sh

spack config add compilers:clang@16.0.6:flags:cflags:[-O3]
./run_compiler_test.sh
Description

No response

Additional information

I've looked into using spack config add compilers:... but because compilers.yaml is a list structure, the spack config add command fails for structural reasons.

I found success in creating a parser argument ,spack compiler set, that enabled me to add the features above but ideally the command should be spack config add for software consistency.

General information
  • I have searched the issues of this repo and believe this is not a duplicate

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining the existing spack config add and spack compiler set CLI behavior, along with how compilers.yaml represents compiler lists. Reproduce the structural failure with the example commands, then define and verify CLI support for adding compiler paths, flags, and environment variables without breaking the configuration structure.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.