From daba1a805ed08121a2cd17f85a489a2ed249b5ab Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 23 Jan 2025 11:45:52 +0100 Subject: [PATCH] build_environment.py: clear CONFIG_SITE for configure scripts (#48690) Should be sufficient to set CONFIG_SITE to /dev/null before running configure to prevent any config site file to be loaded, which currently causes non-determinism in builds. Setting the variable CONFIG_SITE prevents configure files to check $prefix/share/config.site, $prefix/etc/config.site, $ac_default_prefix/share/config.site, $ac_default_prefix/etc/config.site so we don't have to patch a block of code. --- lib/spack/spack/build_environment.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index e240c996def..3e1663131c0 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -301,11 +301,13 @@ def clean_environment(): env.unset("CPLUS_INCLUDE_PATH") env.unset("OBJC_INCLUDE_PATH") + # prevent configure scripts from sourcing variables from config site file (AC_SITE_LOAD). + env.set("CONFIG_SITE", os.devnull) env.unset("CMAKE_PREFIX_PATH") + env.unset("PYTHONPATH") env.unset("R_HOME") env.unset("R_ENVIRON") - env.unset("LUA_PATH") env.unset("LUA_CPATH")