From d8a6aa551e96f72dda7f26508ed4f23ec6832bca Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Mon, 19 Aug 2024 13:49:38 +0200 Subject: [PATCH] build_environment: explicitly disable ccache if disabled (#45275) --- lib/spack/spack/build_environment.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 86bfa5d52a..65ad1dcbb4 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -480,9 +480,12 @@ def set_wrapper_variables(pkg, env): env.set(SPACK_DEBUG_LOG_ID, pkg.spec.format("{name}-{hash:7}")) env.set(SPACK_DEBUG_LOG_DIR, spack.main.spack_working_dir) - # Find ccache binary and hand it to build environment if spack.config.get("config:ccache"): + # Enable ccache in the compiler wrapper env.set(SPACK_CCACHE_BINARY, spack.util.executable.which_string("ccache", required=True)) + else: + # Avoid cache pollution if a build system forces `ccache `. + env.set("CCACHE_DISABLE", "1") # Gather information about various types of dependencies link_deps = set(pkg.spec.traverse(root=False, deptype=("link")))