From bf853a69787f93f3b629491c2c99091bec3667e5 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Mon, 10 Mar 2025 17:25:51 +0100 Subject: [PATCH] bootstrap: ensure compatible libc --- lib/spack/spack/bootstrap/_common.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/spack/spack/bootstrap/_common.py b/lib/spack/spack/bootstrap/_common.py index 2002f51339e..9b34419f9d5 100644 --- a/lib/spack/spack/bootstrap/_common.py +++ b/lib/spack/spack/bootstrap/_common.py @@ -24,6 +24,7 @@ import spack.store import spack.util.environment import spack.util.executable +import spack.util.libc from .config import spec_for_current_python @@ -233,6 +234,9 @@ def _root_spec(spec_str: str) -> str: """ # Add a compiler and platform requirement to the root spec. platform = str(spack.platforms.host()) + spec_str += f" platform={platform}" + target = archspec.cpu.host().family + spec_str += f" target={target}" if platform == "darwin": spec_str += " %apple-clang" @@ -240,11 +244,11 @@ def _root_spec(spec_str: str) -> str: spec_str += " %msvc" elif platform == "linux": spec_str += " %gcc" + libc = spack.util.libc.libc_from_current_python_process() + if libc: + spec_str += f" ^[virtuals=libc] {libc.name}@:{libc.version}" elif platform == "freebsd": spec_str += " %clang" - spec_str += f" platform={platform}" - target = archspec.cpu.host().family - spec_str += f" target={target}" tty.debug(f"[BOOTSTRAP ROOT SPEC] {spec_str}") return spec_str