Message ID | 20191105164646.23820-4-thomas.petazzoni@bootlin.com |
---|---|
State | Accepted |
Headers | show |
Series | Top-level parallel build support | expand |
Thomas, On Tue, Nov 5, 2019 at 10:47 AM Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote: > > Libtool .la files unfortunately contain a number of absolute paths, > which now refer to per-package directories. Due to this, when building > package A, .la files may contain absolute paths referring to > directories in package B per-package sysroot. This causes some -L > flags referring to other sysroot from being added, which doesn't work > as the linker no longer realizes that such paths are within its > sysroot. Building on this top level parallel make series and disabling the "pkg size and bin arch hooks" first (https://pastebin.com/nUb3Qsgs) BR2_aarch64=y BR2_PER_PACKAGE_DIRECTORIES=y BR2_TOOLCHAIN_EXTERNAL=y BR2_INIT_NONE=y # BR2_TARGET_ENABLE_ROOT_LOGIN is not set # BR2_TARGET_GENERIC_GETTY is not set BR2_PACKAGE_ZLIB=y BR2_PACKAGE_LIBXSLT=y # BR2_TARGET_ROOTFS_TAR is not set Then I do a 'make -s -j 32' . Note the number of jobs doesn't seem to matter (still fails without -j set). I get the following error and it looks like all the sysroot paths are valid but it can't find the standard lib.... https://pastebin.com/2W1EKjwd Digging a bit more and I notice the failing build has an extra -L path stuck towards the end of the link line after "-lxml2". I noticed this extra -L path goes away and the build is successful with zlib disabled. I haven't tested but I believe I had a build where the external toolchain includes zlib (bootlin buildroot internal build) and it doesn't appear to include this extra path. I'm guessing the failure is related to how zlib builds with per pkg or a fixup when moving files around. I did check the zlib.pc and it was clean (below). $ cat build/libzlib-1.2.11/zlib.pc prefix=/usr exec_prefix=${prefix} libdir=${exec_prefix}/lib sharedlibdir=${libdir} includedir=${prefix}/include Name: zlib Description: zlib compression library Version: 1.2.11 Requires: Libs: -L${libdir} -L${sharedlibdir} -lz Cflags: -I${includedir} Ideas welcome :-) Regards, Matt
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes: > Libtool .la files unfortunately contain a number of absolute paths, > which now refer to per-package directories. Due to this, when building > package A, .la files may contain absolute paths referring to > directories in package B per-package sysroot. This causes some -L > flags referring to other sysroot from being added, which doesn't work > as the linker no longer realizes that such paths are within its > sysroot. > To fix this, we introduce a replacement step of .la files in the > configure step, to make sure all paths refer to this package > per-package directory. > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Committed to next, thanks.
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index b7b211e6e4..71792d58a9 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -134,6 +134,21 @@ endef GLOBAL_INSTRUMENTATION_HOOKS += step_user endif +####################################### +# Helper functions + +# Make sure .la files only reference the current per-package +# directory. + +# $1: package name (lower case) +# $2: staging directory of the package +ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y) +define fixup-libtool-files + $(Q)find $(2)/usr/lib* -name "*.la" | xargs --no-run-if-empty \ + $(SED) "s:$(PER_PACKAGE_DIR)/[^/]+/:$(PER_PACKAGE_DIR)/$(1)/:g" +endef +endif + ################################################################################ # Implicit targets -- produce a stamp file for each step of a package build ################################################################################ @@ -230,6 +245,7 @@ $(BUILD_DIR)/%/.stamp_configured: @$(call step_start,configure) @$(call MESSAGE,"Configuring") $(call prepare-per-package-directory,$($(PKG)_FINAL_DEPENDENCIES)) + $(call fixup-libtool-files,$(NAME),$(STAGING_DIR)) $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) $($(PKG)_CONFIGURE_CMDS) $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) @@ -919,6 +935,7 @@ $$($(2)_TARGET_INSTALL_IMAGES): PKG=$(2) $$($(2)_TARGET_INSTALL_HOST): PKG=$(2) $$($(2)_TARGET_BUILD): PKG=$(2) $$($(2)_TARGET_CONFIGURE): PKG=$(2) +$$($(2)_TARGET_CONFIGURE): NAME=$(1) $$($(2)_TARGET_RSYNC): SRCDIR=$$($(2)_OVERRIDE_SRCDIR) $$($(2)_TARGET_RSYNC): PKG=$(2) $$($(2)_TARGET_PATCH): PKG=$(2)
Libtool .la files unfortunately contain a number of absolute paths, which now refer to per-package directories. Due to this, when building package A, .la files may contain absolute paths referring to directories in package B per-package sysroot. This causes some -L flags referring to other sysroot from being added, which doesn't work as the linker no longer realizes that such paths are within its sysroot. To fix this, we introduce a replacement step of .la files in the configure step, to make sure all paths refer to this package per-package directory. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> --- package/pkg-generic.mk | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)