From 3f72968e98d546203cf8828779cb5ccf1fb26dcb Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Wed, 28 Jul 2021 17:40:02 -0700 Subject: [PATCH] Clean up build files after building and packaging for deb packages With a Bullseye base image, and PTF being based on Stretch, if there are autogenerated files that are reused from the Bullseye build for Stretch, then autoconf-based packages will fail. This is because the default set of CFLAGS that dpkg passes in includes `-ffile-prefix-map=`, which is not a supported flag with the GCC in Stretch. Then, when running `make clean` in a Stretch environment, make will try to regenerate the autoconf-based files with the cached set of CFLAGS from Bullseye. This causes an error, since that flag is unknown. To work around this, after each build, clean up all built objects and autogenerated files. This makes sure that it is cleaned up in the same environment as the build environment. Note that this issue affects just autoconf packages. For apps using just regular Makefiles, they will probably be fine (they'll still be cleaned up as well). Signed-off-by: Saikrishna Arcot --- slave.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slave.mk b/slave.mk index ea0ffba90d..8417d7aa47 100644 --- a/slave.mk +++ b/slave.mk @@ -491,8 +491,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(a if [ -f ./autogen.sh ]; then ./autogen.sh $(LOG); fi $(SETUP_OVERLAYFS_FOR_DPKG_ADMINDIR) $(if $($*_DPKG_TARGET), - ${$*_BUILD_ENV} DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS_GENERIC} ${$*_DEB_BUILD_OPTIONS}" dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --as-root -T$($*_DPKG_TARGET) --admindir $$mergedir $(LOG), - ${$*_BUILD_ENV} DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS_GENERIC} ${$*_DEB_BUILD_OPTIONS}" dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $$mergedir $(LOG) + ${$*_BUILD_ENV} DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS_GENERIC} ${$*_DEB_BUILD_OPTIONS}" dpkg-buildpackage -rfakeroot -b -us -uc -tc -j$(SONIC_CONFIG_MAKE_JOBS) --as-root -T$($*_DPKG_TARGET) --admindir $$mergedir $(LOG), + ${$*_BUILD_ENV} DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS_GENERIC} ${$*_DEB_BUILD_OPTIONS}" dpkg-buildpackage -rfakeroot -b -us -uc -tc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $$mergedir $(LOG) ) popd $(LOG_SIMPLE) # Clean up