如何更改 Spack 存储 spack-stage 目录的位置?

How to change where Spack stores the spack-stage directory?

Spack 默认写入(在我的系统上)到 /tmp/ 内的目录 spack-stage。在构建大的东西(例如 GCC 本身)时,这个目录可能会变满,至少在我使用的共享系统中是这样:

fatal error: error writing to /tmp/ccPlIYSg.s: No space left on device

有什么方法可以让 Spack 为 spack-stage 使用不同的位置?

根据spack documentation您只需指定$TMP指向您选择的目录即可。

Builds can be faster in temporary directories on some (e.g., HPC) systems. Specifying $tempdir will ensure use of the default temporary directory (i.e., $TMP or $TMPDIR).
Another option that prevents conflicts and potential permission issues is to specify ~/.spack/stage, which ensures each user builds in their home directory.