[Buildroot] [PATCH 20/29 v2] package/boost: check that known libs match Boost's list

Yann E. MORIN yann.morin.1998 at free.fr
Wed Apr 9 20:03:35 UTC 2025


When updating Boost, it can be easy to miss that new libraries are
added, or that older ones are dropped.

We use Boost's ability to list its libraries, to match it against the
set of libraries we know of. If they do not match, we report missing
or dropped libraries.

To get the list from Boost, we need to call 'b2', boost's buildsystem.
However, that is only created after a successful run to bootstrap.
But then only the set of _configured_ libs are reported, not all of
them, so we can't do it as a post-configure hook.

Boost's bootstrap script also allows querying the set of libraries, but
that takes a bit of time as it will build b2 first, and that takes quite
a bit of time. Since we need to evaluate the variable multiple times,
that would be a bit too costly to do a simple assignment with a shell
call-out. Thus the slightly elaborate assignment, which uses memoization
to run the shell call-out only once.

Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
Cc: Michael Nosthoff <buildroot at heine.tech>
Cc: Yegor Yefremov <yegorslists at googlemail.com>
---
 package/boost/boost.mk | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/package/boost/boost.mk b/package/boost/boost.mk
index e849f902f2..7538dcb8f4 100644
--- a/package/boost/boost.mk
+++ b/package/boost/boost.mk
@@ -142,6 +142,35 @@ BOOST_FLAGS += $(if $(BOOST_WITHOUT_FLAGS_COMMASEPARATED), --without-libraries=$
 BOOST_OPTS += $(if $(QUIET),-d0,-d+1)
 HOST_BOOST_OPTS += $(if $(QUIET),-d0,-d+1)
 
+# Check that all the libraries that Boost may build, are actually present
+# in the list of all known libs and handled by Buildroot.
+BOOST_B2_LIBS = \
+	$(if $(filter undefined,$(origin BOOST_B2_LIBS_X)), \
+		$(eval BOOST_B2_LIBS_X := \
+			$(sort \
+				$(shell cd $(BOOST_BUILDDIR) && \
+					./bootstrap.sh --show-libraries \
+					|sed -r -e '/^ +- (.+)$$/!d; s//\1/;' \
+				) \
+			) \
+		) \
+	) \
+	$(BOOST_B2_LIBS_X)
+BOOST_MISSED_LIBS = $(strip $(filter-out $(BOOST_ALL_LIBS),$(BOOST_B2_LIBS)))
+BOOST_GONE_LIBS = $(strip $(filter-out $(BOOST_B2_LIBS),$(BOOST_ALL_LIBS)))
+define BOOST_CHECK_LIBS
+	$(Q)if [ "$(BOOST_GONE_LIBS)" ]; then \
+		printf 'Those libraries known to Buildroot are not present in Boost $(BOOST_VERSION):\n'; \
+		printf '  - %s\n' $(BOOST_GONE_LIBS); \
+	fi
+	$(Q)if [ "$(BOOST_MISSED_LIBS)" ]; then \
+		printf 'Those libraries present in Boost $(BOOST_VERSION) are not known to Buildroot:\n'; \
+		printf '  - %s\n' $(BOOST_MISSED_LIBS); \
+	fi
+	$(Q)[ -z "$(BOOST_GONE_LIBS)" -a -z "$(BOOST_MISSED_LIBS)" ]
+endef
+BOOST_PRE_CONFIGURE_HOOKS += BOOST_CHECK_LIBS
+
 define BOOST_CONFIGURE_CMDS
 	cd $(@D) && ./bootstrap.sh $(BOOST_FLAGS)
 	echo "using gcc : `$(TARGET_CC) -dumpversion` : $(TARGET_CXX) : <cxxflags>\"$(BOOST_TARGET_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > $(@D)/user-config.jam
-- 
2.47.0



More information about the buildroot mailing list