From 899004e29a733a0a741e7e3c80fd706cb3e03b3c Mon Sep 17 00:00:00 2001 From: James Smillie <83249606+jamessmillie@users.noreply.github.com> Date: Fri, 18 Oct 2024 15:37:41 -0600 Subject: [PATCH] Boost: fix logic for controlling which libs build on Windows (#46414) Older builds of Boost were failing on Windows because they were adding --without-... flags for libraries that did not exist in those versions. So: * lib variants are updated with version range info (current range info for libs is not comprehensive, but represents changes over the last few minor versions up to 1.85) * On Windows, --without-... options are omitted for libraries when they don't exist for the version of boost being built. Non-Windows uses a different approach, which was not affected because the new libraries were not activated by default. It would benefit from similar attention though to avoid potential future issues. --- var/spack/repos/builtin/packages/boost/package.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/boost/package.py b/var/spack/repos/builtin/packages/boost/package.py index 50cd7d5a46f..908ea40a89a 100644 --- a/var/spack/repos/builtin/packages/boost/package.py +++ b/var/spack/repos/builtin/packages/boost/package.py @@ -154,8 +154,12 @@ class Boost(Package): "wave", ] + # Add any extra requirements for specific + all_libs_opts = {"charconv": {"when": "@1.85.0:"}, "cobalt": {"when": "@1.84.0:"}} + for lib in all_libs: - variant(lib, default=False, description="Compile with {0} library".format(lib)) + lib_opts = all_libs_opts.get(lib, {}) + variant(lib, default=False, description="Compile with {0} library".format(lib), **lib_opts) @property def libs(self): @@ -624,9 +628,13 @@ def determine_b2_options(self, spec, options): options.append("runtime-link=shared") else: options.append("runtime-link=static") + + # Any lib that is in self.all_libs AND in the variants dictionary + # AND is set to False should be added to options in a --without flag for lib in self.all_libs: - if f"+{lib}" not in spec: - options.append(f"--without-{lib}") + if lib not in self.spec.variants.dict or self.spec.satisfies(f"+{lib}"): + continue + options.append(f"--without-{lib}") if not spec.satisfies("@:1.75 %intel") and not spec.satisfies("platform=windows"): # When building any version >= 1.76, the toolset must be specified.